Java examples for Swing:JFrame
center Frame Window
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { public static void centerFrame(Window window) { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((dim.width - window.getSize().width) / 2, (dim.height - window.getSize().height) / 2); }/*from w ww . j a va 2 s. co m*/ }