aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes A window to the centre of the screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "A window to the centre of the screen" Watch "A window to the centre of the screen" New topic
Author

A window to the centre of the screen

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
hello,
Could you please tell me how to get a window to the center of the screen. I mean it should appear to the centre of the screen
Thanks


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
leo donahue
Ranch Hand

Joined: Apr 17, 2003
Posts: 327
Look in the java docs api index for class Toolkit and Dimension to get the background for what is going on below:
I am using a class that extends JFrame.

let me know if this didn't work for you.
I put this code in my class constructor.
[ July 23, 2003: Message edited by: leo donahue ]

Thanks, leo
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

If you are using a 1.4+ JDK, you can also use :


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A window to the centre of the screen
 
Similar Threads
Regarding Applet Certificate
Centre window on leftmost screen with multiple monitors
CSS puzzle : center a div, but then place another to the right of it
Different windows on Java Perspective
Help with parameters for JOptionPane.showMessageDialog