This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes window position Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "window position" Watch "window position" New topic
Author

window position

chris barr
Ranch Hand

Joined: Apr 20, 2006
Posts: 37
when i create a new window i want it to appear in the center of the screen or at least not the upper left hand conner how do you set were it appears?
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
This is one of my favorite ways:
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you could also try

frame.setLocationRelativeTo(null);

but must be called after the size of the frame is set
i.e. after setSize(...) or after pack()
chris barr
Ranch Hand

Joined: Apr 20, 2006
Posts: 37
thanks .. that works perfectly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: window position
 
Similar Threads
Popup window close button
WA #1.....word association
Swing wait for response
how many remaining?
passing the selected value back to calling page