FileDocCategorySizeDatePackage
ExampleApplet2.javaAPI DocExample1836Sun Jan 04 20:58:58 GMT 1998None

ExampleApplet2

public class ExampleApplet2 extends Applet

Fields Summary
protected Button
b1
protected Button
b2
protected Button
b3
protected GenericButtonAdapter
adapter
Constructors Summary
Methods Summary
public voidhandleB1(java.awt.event.ActionEvent e)

      Button b = (Button)e.getSource();
      System.out.println("handleB1 called for button " + b.getLabel());
   
public voidhandleB2(java.awt.event.ActionEvent e)

      Button b = (Button)e.getSource();
      System.out.println("handleB2 called for button " + b.getLabel());
   
public voidhandleB3(java.awt.event.ActionEvent e)

      Button b = (Button)e.getSource();
      System.out.println("handleB3 called for button " + b.getLabel());
   
public voidinit()


   // the applet initialization
     
   
      // add the buttons to the applet
      add(b1);
      add(b2);
      add(b3);

      try
      {
         adapter = new GenericButtonAdapter(this);
         adapter.registerActionEventHandler(b1, "handleB1");
         adapter.registerActionEventHandler(b2, "handleB2");
         adapter.registerActionEventHandler(b3, "handleB3");
      }
      catch (ClassNotFoundException e)
      {
         System.out.println(e);
      }
      catch (NoSuchMethodException e)
      {
         System.out.println(e);
      }