Полезная информация

Java in a Nutshell

Previous Chapter 18
The java.awt Package
Next
 

18.2 java.awt.AWTEvent (JDK 1.1)

This abstract class serves as the root event type for all AWT events in Java 1.1 and supersedes the Event class which was used in Java 1.0.

Each AWTEvent has a source object, as all EventObject objects do. You can query the source of an event with the inherited getSource() method. The AWTEvent class adds an event type, or "id," for every AWT event. Use getID() to query the type of the event. Subclasses of AWTEvent define various constants for this type field.

The various _MASK constants defined by this class allow Component.enableEvents() to be called by applets and custom components that want to receive various event types without having to register an EventListener object to receive them.

public abstract class AWTEvent extends EventObject {
    // Public Constructors
            public AWTEvent(Event event);
            public AWTEvent(Object source, int id);
    // Constants
            public static final long ACTION_EVENT_MASK;
            public static final long ADJUSTMENT_EVENT_MASK;
            public static final long COMPONENT_EVENT_MASK;
            public static final long CONTAINER_EVENT_MASK;
            public static final long FOCUS_EVENT_MASK;
            public static final long ITEM_EVENT_MASK;
            public static final long KEY_EVENT_MASK;
            public static final long MOUSE_EVENT_MASK;
            public static final long MOUSE_MOTION_EVENT_MASK;
            public static final int RESERVED_ID_MAX;
            public static final long TEXT_EVENT_MASK;
            public static final long WINDOW_EVENT_MASK;
    // Protected Instance Variables
            protected boolean consumed;
            protected int id;
    // Public Instance Methods
            public int getID();
            public String paramString();
            public String toString();  // Overrides EventObject
    // Protected Instance Methods
            protected void consume();
            protected boolean isConsumed();
}

Hierarchy:

Object->EventObject(Serializable)->AWTEvent

Extended By:

ActionEvent, AdjustmentEvent, ComponentEvent, ItemEvent, TextEvent

Passed To:

Button.processEvent(), Checkbox.processEvent(), CheckboxMenuItem.processEvent(), Choice.processEvent(), Component.dispatchEvent(), Component.processEvent(), ComponentPeer.handleEvent(), Container.processEvent(), EventQueue.postEvent(), List.processEvent(), MenuComponent.dispatchEvent(), MenuComponent.processEvent(), MenuItem.processEvent(), Scrollbar.processEvent(), TextComponent.processEvent(), TextField.processEvent(), Window.processEvent()

Returned By:

EventQueue.getNextEvent(), EventQueue.peekEvent()


Previous Home Next
java.awt.AWTError (JDK 1.0) Book Index java.awt.AWTEventMulticaster (JDK 1.1)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java