public class AnySmallApplet
1: // SmallApplet.java
2: // A "shell" for any small, simple applet
3:
4: import java.applet.Applet;
5: import java.awt.event.*;
6: import java.awt.*;
7:
8:
9: public class AnySmallApplet
10: extends Applet
11: implements ActionListener
12: {
13: // Put instance variables here, such as ...
14: private Button aButton;
15:
16:
17: // Override the init() method to get set up ...
18: public void init()
19: {
20: aButton = new Button("Press Me");
21: add(aButton);
22: aButton.addActionListener(this);
23: }
24:
25:
26: // Override this method, which gets called auotmatically ...
27: public void paint(Graphics g)
28: {
29: // Code to deal with the Graphics object g
30: }
31:
32:
33: public void actionPerformed(ActionEvent event)
34: {
35: if (event.getSource() == aButton)
36: // Code to respond to button being pressed
37: repaint(); // if needed
38: }
39: }