Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A window to the centre of the screen

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
leo donahue
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a 1.4+ JDK, you can also use :
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic