List of usage examples for java.awt Container setLocation
public void setLocation(Point p)
From source file:Main.java
public static void setScreenCenter(Container container) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension screenDimension = toolkit.getScreenSize(); int width = container.getWidth(); int height = container.getHeight(); Point point = new Point(); point.setLocation((screenDimension.getWidth() - width) / 2, (screenDimension.getHeight() - height) / 2); container.setLocation(point); }