AWTEvent
Name
AWTEvent
Description
The root class of all AWT events. Subclasses of this class are the replacement for java.awt.Event
, which is only used for the Java 1.0.2 event model. In Java 1.1, event objects are passed from event source components to objects implementing a corresponding listener interface. Some event sources have a corresponding interface, too. For example, AdjustmentEvent
s are passed from Adjustable
objects to AdjustmentListener
s. Some event types do not have corresponding interfaces; for example, ActionEvent
s are passed from Button
s to ActionListener
s, but there is no "Actionable" interface that Button
implements.
Class Definition
public abstract class java.awt.AWTEvent extends java.util.EventObject { // Constants public final static long ACTION_EVENT_MASK; public final static long ADJUSTMENT_EVENT_MASK; public final static long COMPONENT_EVENT_MASK; public final static long CONTAINER_EVENT_MASK; public final static long FOCUS_EVENT_MASK; public final static long ITEM_EVENT_MASK; public final static long KEY_EVENT_MASK; public final static long MOUSE_EVENT_MASK; public final static long MOUSE_MOTION_EVENT_MASK; public final static long RESERVED_ID_MAX; public final static long TEXT_EVENT_MASK; public final static long WINDOW_EVENT_MASK; // Variables protected boolean consumed; protected int id; // Constructors public AWTEvent (Event event); public AWTEvent (Object source, int id); // Instance Methods public int getID(); public String paramString(); public String toString(); // Protected Instance Methods protected void consume(); protected boolean isConsumed(); }
Constants
ACTION_EVENT_MASK
public static final long ACTION_EVENT_MASK
The mask for action events.
ADJUSTMENT_EVENT_MASK
public static final long ADJUSTMENT_EVENT_MASK
The mask for adjustment events.
COMPONENT_EVENT_MASK
public static final long COMPONENT_EVENT_MASK
The mask for component events.
CONTAINER_EVENT_MASK
public static final long CONTAINER_EVENT_MASK
The mask for container events.
FOCUS_EVENT_MASK
public static final long FOCUS_EVENT_MASK
The mask for focus events.
ITEM_EVENT_MASK
public static final long ITEM_EVENT_MASK
The mask for item events.
KEY_EVENT_MASK
public static final long KEY_EVENT_MASK
The mask for key events.
MOUSE_EVENT_MASK
public static final long MOUSE_EVENT_MASK
The mask for mouse events.
MOUSE_MOTION_EVENT_MASK
public static final long MOUSE_MOTION_EVENT_MASK
The mask for mouse motion events.
RESERVED_ID_MAX
public static final int
The maximum reserved event id.
TEXT_EVENT_MASK
public static final long TEXT_EVENT_MASK
The mask for text events.
WINDOW_EVENT_MASK
public static final long WINDOW_EVENT_MASK
The mask for window events.
Variables
consumed
protected boolean consumed
If consumed
is true
, the event will not be sent back to the peer. Semantic events will never be sent back to a peer; thus consumed
is always true
for semantic events.
id
protected int id
The type ID of this event.
Constructors
AWTEvent
public AWTEvent (Event event)
- Parameters
-
- event
- A version 1.0.2
java.awt.Event
object.
- Description
- Constructs a 1.1
java.awt.AWTEvent
derived from a 1.0.2java.awt.Event
object.
public AWTEvent (Object source, int id)
- Parameters
-
- source
- The object that the event originated from.
- id
- An event type ID.
- Description
- Constructs an
AWTEvent
object.
Instance Methods
getID
public int getID()
- Returns
- The type ID of the event.
paramString
public String paramString()
- Returns
- A string with the current settings of
AWTEvent
. - Description
- Helper method for
toString()
that generates a string of current settings.
toString
public String toString()
- Returns
- A string representation of the
AWTEvent
object. - Overrides
Object.toString()
Protected Instance Methods
consume
protected void consume()
- Description
- Consumes the event so it is not sent back to its source.
isConsumed
public boolean isConsumed()
- Returns
- A flag indicating whether this event has been consumed.
See Also
ActionEvent
, AdjustmentEvent
, ComponentEvent
, Event
, EventObject
, FocusEvent
, ItemEvent
, KeyEvent
, MouseEvent
, WindowEvent