Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to center a JFrame when it comes up

Reply
Thread Tools

How to center a JFrame when it comes up

 
 
clusardi2k@aol.com
Guest
Posts: n/a
 
      08-28-2012
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,
 
Reply With Quote
 
 
 
 
markspace
Guest
Posts: n/a
 
      08-28-2012
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!!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How Can I Get One JFrame To Appear Above Another JFrame clusardi2k@aol.com Java 2 08-27-2012 03:00 PM
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
Naming of core NASA center with the words "Mission Control Center" & mass use of religious anthem sounding word "Mission" in Context of Space Exploration & the Moon Landing Hoax moonlandinghoaxreligious@yahoo.com Digital Photography 0 09-27-2005 08:28 PM
Re: NOD32 Ctl. center comes on 2 X and Stays! Why? Ritter197 Computer Security 1 02-17-2005 12:08 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57