How to maximize a JFrame through code? August 12, 2023 by Tarik Try this: f.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH );