Java tutorial
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { /** GUI utility (set frame on the center of screen) */ public static void setCenter(Window w) { Dimension scSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension wndSize = w.getSize(); w.setLocation((scSize.width - wndSize.width) / 2, (scSize.height - wndSize.height) / 2); } }