How to minimize a JFrame window from Java?

Minimize:

frame.setState(Frame.ICONIFIED);

Another way to minimize:

frame.setExtendedState(JFrame.ICONIFIED);

Normal size:

frame.setState(Frame.NORMAL);

Another way to normal size:

frame.setExtendedState(JFrame.NORMAL);

Maximize:

frame.setState(Frame.MAXIMIZED_BOTH);

Another way to maximize:

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

Full Screen maximize:

GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0];
try { device.setFullScreenWindow((Window) frame); } finally { device.setFullScreenWindow(null); }

Refer to the JFrame documentation for more information.


minimize with frame.setState(Frame.ICONIFIED)

restore with frame.setState(Frame.NORMAL)