problem in alignment of JFrame in NetBeans. How can I set it in center of main window?
I have tried
public AdminLogin() {
initComponents();
this.setLocationRelativeTo(null);
}
problem in alignment of JFrame in NetBeans. How can I set it in center of main window?
I have tried
public AdminLogin() {
initComponents();
this.setLocationRelativeTo(null);
}
You need to invoke the setLocationRelativeTo( null )
after the size of the frame has been determined.
The basic structure for the code should be:
frame.add(...);
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );