\begin{slide}{Beispiel: ActionListener}

\begin{small}
\begin{verbatim}
interface ActionListener 
  { void actionPerformed (ActionEvent e); }
\end{verbatim}
\end{small}
\hrule
\begin{small}
\begin{verbatim}
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));
  } 
}
\end{verbatim}
\end{small}

\end{slide}
