1import java.applet.Applet;
2import java.awt.*;
3import java.awt.event.*;
4
5public
6class ButtonApplet extends Applet {
7
8 TextArea t;
9 Button b;
10
11 public
12 void init () {
13 t = new TextArea("",6,40,TextArea.SCROLLBARS_VERTICAL_ONLY);
14 b = new Button("druecke mich");
15
16 b.addActionListener(new ButtonPressListener(this));
17
18 add(t);
19 add(b);
20 }
21}
22
23class ButtonPressListener
24 implements ActionListener
25{
26 ButtonApplet a;
27
28 public
29 ButtonPressListener(ButtonApplet a) {
30 this.a = a;
31 }
32
33 public
34 void actionPerformed(ActionEvent e) {
35 a.t.append("autsch!!!\n");
36 }
37}
38
39