Java examples for Swing:JFrame
set Frame To Screen Center
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; public class Main { public static void setFrameToScreenCenter(Window frame) { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation(screen.width / 2 - frame.getWidth() / 2, screen.height / 2 - frame.getHeight() / 2); }// w ww. jav a 2 s . co m }