Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get the size of the screen
- Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
- // Determine the new location of the window
- int w = fenetre.getSize().width;
- int h = fenetre.getSize().height;
- int x = (dim.width-w)/2;
- int y = (dim.height-h)/2;
- // Move the window
- fenetre.setLocation(x, y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement