import java.awt.* ;
import java.awt.event.* ;

public class TestFrame extends Frame
    implements ActionListener, WindowListener {

  private Button b1;

  public TestFrame (String s) {
    super(s);
  }

  public void init() {
    setLayout (new FlowLayout() );
    b1 = new Button("Press me! ");
    b1.addActionListener (this);
    add(b1);
    addWindowListener(this);
    setSize(300,200); // or: pack();
    setVisible(true);
  }

  public static void main (String[] args) {
    TestFrame f = new TestFrame("Test");
    f.init();
  }

  public void actionPerformed (ActionEvent e) {
    System.out.println("Button was pressed.");
  }
  public void windowClosing (WindowEvent e) {
    dispose();
    System.exit(0);
  }
  public void windowClosed (WindowEvent e) { }
  public void windowOpened (WindowEvent e) { }
  public void windowIconified (WindowEvent e) { }
  public void windowDeiconified (WindowEvent e) { }
  public void windowActivated (WindowEvent e) { }
  public void windowDeactivated (WindowEvent e) { }
}


