1import java.awt.BorderLayout;
2import java.awt.event.ActionEvent;
3import java.awt.event.ActionListener;
4
5import javax.swing.JApplet;
6import javax.swing.JButton;
7import javax.swing.JScrollPane;
8import javax.swing.JTextArea;
9
10public
11 class ButtonApplet4 extends JApplet {
12
13 JTextArea t;
14 JScrollPane d;
15 JButton b;
16
17 public
18 void init () {
19 t = new JTextArea(10,40);
20 d = new JScrollPane(t);
21 b = new JButton("druecke mich");
22
23 b.addActionListener
24 (new ActionListener() {
25 public
26 void actionPerformed(ActionEvent e) {
27 t.append("autsch!!!\n");
28 }
29 }
30 );
31
32 setLayout(new BorderLayout());
33 add(d,BorderLayout.CENTER);
34 add(b,BorderLayout.SOUTH);
35 }
36 }
37
38