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