How to center a JFrame when it comes up

Discussion in 'Java' started by clusardi2k@aol.com, Aug 28, 2012.

  1. Guest

    I would like to have a JFrame come up from anther one and center it on the screen. Hoe do I do this.

    Can I do it with two JFrames produced in NetBeans Design view.

    Thank you,
    , Aug 28, 2012
    #1
    1. Advertising

  2. markspace Guest

    On 8/28/2012 3:03 PM, wrote:
    > I would like to have a JFrame come up from anther one and center it
    > on the screen. Hoe do I do this.
    >
    > Can I do it with two JFrames produced in NetBeans Design view.



    This is an RTFM question, but the answer can be tricky to find, so:

    <http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html>


    "This example does not set the frame location, but it is easy to do so
    using either the setLocationRelativeTo or setLocation method. For
    example, the following code centers a frame onscreen:

    frame.setLocationRelativeTo(null);"


    Read the docs!!
    markspace, Aug 29, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tu-Thach

    Were request comes from

    Tu-Thach, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    807
    Tu-Thach
    Jun 26, 2003
  2. Natty Gur

    Re: Were request comes from

    Natty Gur, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    811
    Natty Gur
    Jun 26, 2003
  3. Jerry
    Replies:
    0
    Views:
    287
    Jerry
    Jul 8, 2003
  4. jakester
    Replies:
    3
    Views:
    1,824
    jakester
    Apr 3, 2007
  5. Replies:
    2
    Views:
    413
    markspace
    Aug 27, 2012
Loading...

Share This Page