jframe center on screen code example
Example 1: open jframe in center of screen
add this after setbounds
setLocationRelativeTo(null);
Example 2: how to put jframe in center of screen using jframe properties
public frame() {
initComponents();
this.setLocationRelativeTo(null);
}
Example 3: open jframe in center of screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);