interface ActionListener { void actionPerformed (ActionEvent e); }
public class Check extends Applet { int s = 0; Label l = new Label ("foo"); void change (int d) { s = s + d; l.setText (Integer.toString (s)); } } class AL implements ActionListener { int d; AL (int x) { d = x; } public void actionPerformed (ActionEvent e) { change (d); } } public void init () { add (l); l.addActionListener (new AL (1)); } }