import java.awt.GraphicsEnvironment; import javax.swing.JFrame; public class Main extends JFrame { public Main() { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); this.setExtendedState(this.getExtendedState() | this.MAXIMIZED_BOTH); } public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); Main t = new Main(); t.setVisible(true); } }