It has been quite some time since I used this :
Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize(); MainFrame mainFrame = new MainFrame(); int halfWidth = mainFrame.getWidth() / 2; int halfHeight = mainFrame.getHeight() / 2; mainFrame.setLocation(SCREEN_SIZE.width / 2 - halfWidth, SCREEN_SIZE.height / 2 - halfHeight); mainFrame.setVisible(true);
Example for a Frame.
And apparently, you can use this one line instead:
mainFrame.setLocationRelativeTo(null); // or 'this' to parent
damn
January 28, 2009 at 6:05 pm
rm -rf *? (tetep)January 28, 2009 at 8:00 pm
kasiyan (tetep)
January 29, 2009 at 12:37 am
January 29, 2009 at 12:39 am
ah emoticon sux
January 29, 2009 at 10:28 am
wakakakak sokor