List of usage examples for java.awt Dialog setLocation
@Override public void setLocation(int x, int y)
The method changes the geometry-related data.
From source file:Main.java
/** Repositions a frame to be centered on the screen */ public static void center(Dialog frame) { Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screen = tk.getScreenSize(); Dimension win = frame.getSize(); //frame.setSize(screenWidth / 2, screenHeight / 2); frame.setLocation((screen.width - win.width) / 2, (screen.height - win.height) / 2); }