import java.awt.*;
import java.awt.event.*;
class AwtG extends Frame {
    public static void main(String[] arg) {
        new AwtG();
    }
    AwtG() {
        addWindowListener(
            new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
                }
            }
        );
        setVisible(true);
        final TextField t = new TextField(40);
        add("North", t);
        Button b = new Button("Clear");
        add("South", b);
        b.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    t.setText("");
                }
            }
        );
        pack();
    }
}

// anonymous class -- a noname subclass of WindowAdapter

// anonymous class can be derived from an interface
// in this case, its superclass is java.lang.Object

// t must be final
