Java:Open Your Software in the Middle of the Desktop
November 21, 2010 Leave a comment
By default Java Programs(GUI based)actually starts/Open in the side of the desktop. IF you want your java program/software (where GUI such as JFrame or JPanel is used) to open by default in the middle of the desktop then it’s for you.
Here I have given the code which will help you to open your java (JFrame window) in the middle of the desktop.
Whatever the resolution of your desktop monitor has, this code will help you to open your desire java written software exactly in the middle of the monitor.
public class middlePosition extends JFrame
private Toolkit toolkit;
JPanel panel=new JPanel();
setTitle(“Set JFrame Window in the middle of the Desktop”);
public static void main(String args)
middlePosition x=new middlePosition();