import java.awt.*;
import java.awt.event.*;
class AwtE extends Frame {
    public static void main(String[] arg) {
        new AwtE();
    }
    AwtE() {
        addWindowListener(new WindowAdapterE());
        setVisible(true);
        TextField t = new TextField(40);
        add("North", t);
        Button b = new Button("Clear");
        add("South", b);
        b.addActionListener(new ActionListenerE(t));
        pack();
    }
}
class WindowAdapterE extends WindowAdapter {
    public void windowClosing(WindowEvent e) {
    	System.exit(0);
    }
}
class ActionListenerE implements ActionListener {
    TextField t;
    ActionListenerE(TextField t) {
        this.t = t;
    }
    public void actionPerformed(ActionEvent e) {
        t.setText("");  
    }
}

// Frame是一個Container，可以包含其他Component
// line 25: passing of "t" is necessary

