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 ButtonApplet3 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(new ButtonPressListener());
24
25 setLayout(new BorderLayout());
26 add(d,BorderLayout.CENTER);
27 add(b,BorderLayout.SOUTH);
28 }
29
30
31
32 class ButtonPressListener
33 implements ActionListener {
34 public
35 void actionPerformed(ActionEvent e) {
36 t.append("autsch!!!\n");
37 }
38 }
39 }