How to maximize a JFrame through code?

Tony Ogrewall picture Tony Ogrewall · Mar 10, 2011 · Viewed 57.6k times · Source

How to maximize a JFrame through code?

Answer

Harry Joy picture Harry Joy · Mar 10, 2011

Try this:

f.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH );