1
2
3import java.applet.Applet;
4import java.awt.Graphics;
5
6public
7class Simple extends Applet {
8
9 StringBuffer buffer;
10
11 public
12 void init() {
13 buffer = new StringBuffer();
14 addItem("initializing... ");
15 }
16
17 public
18 void start() {
19 addItem("starting... ");
20 }
21
22 public
23 void stop() {
24 addItem("stopping... ");
25 }
26
27 public
28 void destroy() {
29 addItem("preparing for unloading...");
30 }
31
32 void addItem(String newWord) {
33 System.out.println(newWord);
34 buffer.append(newWord);
35 repaint();
36 }
37
38 public
39 void paint(Graphics g) {
40
41 g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
42
43
44 g.drawString(buffer.toString(), 5, 15);
45 }
46}