Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18366 > unrolled thread

How to center a JFrame when it comes up

Started byclusardi2k@aol.com
First post2012-08-28 15:03 -0700
Last post2012-08-28 16:57 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How to center a JFrame when it comes up clusardi2k@aol.com - 2012-08-28 15:03 -0700
    Re: How to center a JFrame when it comes up markspace <-@.> - 2012-08-28 16:57 -0700

#18366 — How to center a JFrame when it comes up

Fromclusardi2k@aol.com
Date2012-08-28 15:03 -0700
SubjectHow to center a JFrame when it comes up
Message-ID<0704555b-cf8b-4319-9949-b39cb098991c@googlegroups.com>
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,

[toc] | [next] | [standalone]


#18371

Frommarkspace <-@.>
Date2012-08-28 16:57 -0700
Message-ID<k1jlss$qj5$1@dont-email.me>
In reply to#18366
On 8/28/2012 3:03 PM, clusardi2k@aol.com 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!!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web