Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // Get the size of the screen
  2. Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  3.  
  4. // Determine the new location of the window
  5. int w = fenetre.getSize().width;
  6. int h = fenetre.getSize().height;
  7. int x = (dim.width-w)/2;
  8. int y = (dim.height-h)/2;
  9.  
  10. // Move the window
  11. fenetre.setLocation(x, y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement