Here you can find the source of setFramePositon(JFrame inTargetFrame)
static void setFramePositon(JFrame inTargetFrame)
//package com.java2s; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JFrame; public class Main { static void setFramePositon(JFrame inTargetFrame) { Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = inTargetFrame.getSize(); // (ulrivo): full size on screen with less than 640 width if (d.width >= 640) { inTargetFrame.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2); } else {/*from w w w.j a v a 2 s .c om*/ inTargetFrame.setLocation(0, 0); inTargetFrame.setSize(d); } } }