Reputation: 9989
I've got code that looks something like this, which makes my JFrame fullscreen:
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
JFrame myFrame = new JFrame("Title", device);
myFrame.setVisible(true);
myFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
myFrame.setUndecorated(true);
myFrame.setResizable(false);
myFrame.validate();
device.setFullScreenWindow(myFrame);
How do I later get that same JFrame to stop being fullscreen and revert to being just a normal window? I don't see any opposite to the setFullScreenWindow
method on the GraphicsDevice class. I'd like to be able to toggle back and forth as needed.
Upvotes: 2
Views: 3079
Reputation: 975
Use setFullScreenWindow(null);
and then call myFrame.setVisible(true);
Upvotes: 2