How can I set my JFrame to a specific psotion on the screen? I've already managed to fix its size. I want it to be at a standard location on the screen and not be moved by the user.
You can fixate it as follows:
frame.setResizable(false);
frame.setUndecorated(true);
Or better: by adding a Component listener:
frame.addComponentListener( new ComponentListener() {
public void componentResized( ComponentEvent e ) {}
public void componentMoved( ComponentEvent e ) {
setLocation( FIX_X, FIX_Y );
}
public void componentShown( ComponentEvent e ) {}
public void componentHidden( ComponentEvent e ) {}
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With