1import java.applet.Applet;
2import java.awt.*;
3import java.awt.event.*;
4
5public
6class ButtonApplet2 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
23
24
25 static
26 class ButtonPressListener
27 implements ActionListener
28 {
29 ButtonApplet2 a;
30
31 public
32 ButtonPressListener(ButtonApplet2 a) {
33 this.a = a;
34 }
35
36 public
37 void actionPerformed(ActionEvent e) {
38 a.t.append("autsch!!!\n");
39 }
40 }
41}
42
43