next up previous
Nächste Seite: Applets in Webseiten einbetten Aufwärts: Applet-Programmierung Vorherige Seite: Ereignis-Behandlung in Applets

Ereignis-Behandlung in Applets (II)

$ $Id: event.tex,v 1.1 2003/12/04 12:39:55 joe Exp $ $

public class Counter { ...
 Button inc = new Button ("inc");
 class Inc_L implements ActionListener {
  public void actionPerformed (ActionEvent a) {
    status++; update ();
  }
 }
 public void init () { ...
  add (inc);
  inc.addActionListener (new Inc_L ());
 }
}
Aufgaben: füge Knöpfe für decrement und reset hinzu.



Johannes Waldmann 2004-01-30