Originally (See my previous question "Java how to make JFrames start off as a maximised window") I wanted to make a window which starts out maximised. This code accomplishes this:
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
}
However, if this window is restored down it becomes a practically non-existent bar. To solve this I set a size for the window using setSize(). This works but presents another problem, the window can still be resized.
To solve this problem I set setResizable(false); and this is my code so far:
public static void main(String[] args) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
JFrame frame = new JFrame("Jedia");
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setSize(screenSize);
frame.setResizable(false);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
However, now the window starts out at its specified size (rather than maximised) and cannot be restored up.
So, my question is, how can I either make the window start out maximised, give it a size for when it is restored down and make resizing it impossible? Or make a window that starts out maximised and cannot be restored down?