// This example is from the book _Java AWT Reference_ by John Zukowski. // Written by John Zukowski. Copyright (c) 1997 O'Reilly & Associates. // You may study, use, modify, and distribute this example for any purpose. // This example is provided WITHOUT WARRANTY either expressed or import java.awt.*; import java.applet.*; class TheButton extends Button { TheButton (String s) { super (s); } public boolean action (Event e, Object o) { if ("One".equals(o)) { System.out.println ("Do something for One"); } else if ("Two".equals(o)) { System.out.println ("Ignore Two"); } else if ("Three".equals(o)) { System.out.println ("Reverse Three"); } else if ("Four".equals(o)) { System.out.println ("Four is the one"); } else { return false; } return true; } } public class ButtonTest extends Applet { public void init () { add (new TheButton ("One")); add (new TheButton ("Two")); add (new TheButton ("Three")); add (new TheButton ("Four")); } }