Here you can find the source of setCenterLocation(final Window window)
public synchronized static void setCenterLocation(final Window window)
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { public synchronized static void setCenterLocation(final Window window) { final Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation(dim.width / 2 - window.getSize().width / 2, dim.height / 2 - window.getSize().height / 2); }/*from w w w. j a va 2s .c o m*/ }