We would like to know how to maximize JFrame.
/*from w ww. j av a 2 s . c om*/ import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; public class Main extends JFrame { JButton qb = new JButton("quit"); JPanel p1 = new JPanel(); JMenuBar menubar = new JMenuBar(); JMenu file = new JMenu("File"); JMenuItem eMenuItem = new JMenuItem("Exit"); public Main() { setSize(300, 300); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setAlwaysOnTop(true); setResizable(true); setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); menubar.add(file); setJMenuBar(menubar); file.add(eMenuItem); } public static void main(String[] args) { new Main(); } }