How do I maximize a Frame/JFrame ?

John Zukowski

There is no direct support for this. The best you can do is make sure the frame is deiconified then set its size to the screen size.

Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension dimension = toolkit.getScreenSize();

[FAQ Manager Note] The operating system will not treat this as a maximized frame, so in general this is not a good idea for simulating maximize. I'd recommend that you only set the state to NORMAL to ensure the window is visible (not minimized/iconified) and allow the user to press the maximize button if they want.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact