Another way is to add a window listener and a reset state when it is deactivated:
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowDeactivated(WindowEvent e) {
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
});
But disabling the screen saver may be best for a start.
source
share