Maximizing an AWT Frame

From 1.3 onwards, use setExtendedState(Frame.MAXIMIZED_BOTH)

Main.java:

import java.awt.event.*;
import java.awt.*;
 
public class Main extends Frame implements ActionListener
{
   public Main()
   {
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
            System.exit(1);
         }
      });
 
      Button maxButton = new Button("Maximize this Frame");
      setLayout(new FlowLayout(FlowLayout.LEFT));
      add(maxButton);
      maxButton.addActionListener(this);
   }
 
   public void actionPerformed(ActionEvent ae) {     
      setExtendedState(Frame.MAXIMIZED_BOTH);
   }
 
   public static void main(String args[])
   {
      Main main = new Main();
      main.setSize(300, 150);
      main.setVisible(true);
   }
}