By Alvin Alexander. Last updated: March 10, 2018
As a quick note today, here’s some code that shows how to maximize a JFrame:
MyJFrame myFrame = new MyJFrame(); // do other stuff here ... // this maximizes the jframe myFrame.setState(Frame.NORMAL); // do whatever else you want to do ... myFrame.setVisible();
How to minimize a JFrame
To minimize a JFrame just do this:
MyJFrame myFrame = new MyJFrame(); // do other stuff here ... // minimize myFrame.setState(Frame.ICONIFIED);
If you needed to see how to programmatically maximize and minimize a JFrame in Java, I hope that was helpful.