Here you can find the source of moveToScreenCenter(Window w)
public static void moveToScreenCenter(Window w)
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { public static void moveToScreenCenter(Window w) { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); w.setLocation((screen.width - w.getWidth()) / 2, (screen.height - w.getHeight()) / 2); }/*from w w w .j a va 2 s . c om*/ }