next up previous contents
Next: MyIO Package Up: MyAwt Package Previous: NumberLabelGroup Class

SEvent Class

The SEvent class was taken almost directly from graphic Java [4]. It is a simple extension of the Event class. This class allows the NumberLabel class (or any other class) to generate a selection Event.

package MyAwt;

import java.awt.*;

public class SEvent extends Event {

   public static final int SELECT =1, DESELECT =2;

   private int et;

   public SEvent(Object target, Event event, int type) {
      super(target, event.when, event.id, event.x,
            event.y, event.key, event.modifiers, event.arg);
      if (type!=SELECT && type!=DESELECT) {
         System.out.println("Error: in SEvent, " 
                            + type + " is not a valid SEvent type");
         System.exit(1);
      }
      et = type;
      id = -1;
   }

   public boolean select() { return et==SELECT; }

   public boolean deselect() { return et==DESELECT; }

}



Kelly Waters
Mon Oct 27 18:18:15 EST 1997