jQuery in Action, 3rd edition
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "window position" Watch "window position" New topic

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


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
It's not a secret anymore!