PDAP Public Review Draft

java.awt
Class AWTEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--java.awt.AWTEvent
Direct Known Subclasses:
ActionEvent, AdjustmentEvent, ComponentEvent, InvocationEvent, ItemEvent, TextEvent

public abstract class AWTEvent
extends EventObject

The root event class for all AWT events. This class and its subclasses supercede the original java.awt.Event class. Subclasses of this root AWTEvent class defined outside of the java.awt.event package should define event ID values greater than the value defined by RESERVED_ID_MAX.

The event masks defined in this class are needed by Component subclasses which are using Component.enableEvents() to select for event types not selected by registered listeners. If a listener is registered on a component, the appropriate event mask is already set internally by the component.

The masks are also used to specify to which types of events an AWTEventListener should listen. The masks are bitwise-ORed together and passed to Toolkit.addAWTEventListener.

Since:
1.1
See Also:
Component.enableEvents(long), Toolkit.addAWTEventListener(java.awt.event.AWTEventListener, long), ActionEvent, AdjustmentEvent, ComponentEvent, ContainerEvent, FocusEvent, InvocationEvent, ItemEvent, KeyEvent, MouseEvent, PaintEvent, TextEvent, WindowEvent

Field Summary
static long ACTION_EVENT_MASK
          The event mask for selecting action events.
static long ADJUSTMENT_EVENT_MASK
          The event mask for selecting adjustment events.
static long COMPONENT_EVENT_MASK
          The event mask for selecting component events.
protected  boolean consumed
          This field controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer, true means it's not.
static long CONTAINER_EVENT_MASK
          The event mask for selecting container events.
static long FOCUS_EVENT_MASK
          The event mask for selecting focus events.
protected  int id
          This field contains the event's event id
static long ITEM_EVENT_MASK
          The event mask for selecting item events.
static long KEY_EVENT_MASK
          The event mask for selecting key events.
static long MOUSE_EVENT_MASK
          The event mask for selecting mouse events.
static long MOUSE_MOTION_EVENT_MASK
          The event mask for selecting mouse motion events.
static int RESERVED_ID_MAX
          The maximum value for reserved AWT event IDs.
static long TEXT_EVENT_MASK
          The event mask for selecting text events.
static long WINDOW_EVENT_MASK
          The event mask for selecting window events.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
AWTEvent(Event event)
          Constructs an AWTEvent object from the parameters of a 1.0-style event.
AWTEvent(java.lang.Object source, int id)
          Constructs an AWTEvent object with the specified source object and type.
 
Method Summary
protected  void consume()
           
protected  void finalize()
          frees any native data held by this object.
 int getID()
          Returns the event type.
protected  boolean isConsumed()
           
 java.lang.String paramString()
          Returns a string representing the state of this event.
 java.lang.String toString()
          Returns a String representation of this EventObject.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id
This field contains the event's event id
See Also:
getID(), AWTEvent(Object, int)

consumed

protected boolean consumed
This field controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer, true means it's not. Semantic events always have a 'true' value since they were generated by the peer in response to a low-level event.
See Also:
consume(), isConsumed()

COMPONENT_EVENT_MASK

public static final long COMPONENT_EVENT_MASK
The event mask for selecting component events.

Value 0x01 is assigned to COMPONENT_EVENT_MASK.


CONTAINER_EVENT_MASK

public static final long CONTAINER_EVENT_MASK
The event mask for selecting container events.

Value 0x02 is assigned to CONTAINER_EVENT_MASK.


FOCUS_EVENT_MASK

public static final long FOCUS_EVENT_MASK
The event mask for selecting focus events.

Value 0x04 is assigned to FOCUS_EVENT_MASK.


KEY_EVENT_MASK

public static final long KEY_EVENT_MASK
The event mask for selecting key events.

Value 0x08 is assigned to KEY_EVENT_MASK.


MOUSE_EVENT_MASK

public static final long MOUSE_EVENT_MASK
The event mask for selecting mouse events.

Value 0x10 is assigned to MOUSE_EVENT_MASK.


MOUSE_MOTION_EVENT_MASK

public static final long MOUSE_MOTION_EVENT_MASK
The event mask for selecting mouse motion events.

Value 0x20 is assigned to MOUSE_MOTION_EVENT_MASK.


WINDOW_EVENT_MASK

public static final long WINDOW_EVENT_MASK
The event mask for selecting window events.

Value 0x40 is assigned to WINDOW_EVENT_MASK.


ACTION_EVENT_MASK

public static final long ACTION_EVENT_MASK
The event mask for selecting action events.

Value 0x80 is assigned to ACTION_EVENT_MASK.


ADJUSTMENT_EVENT_MASK

public static final long ADJUSTMENT_EVENT_MASK
The event mask for selecting adjustment events.

Value 0x100 is assigned to ADJUSTMENT_EVENT_MASK.


ITEM_EVENT_MASK

public static final long ITEM_EVENT_MASK
The event mask for selecting item events.

Value 0x200 is assigned to ITEM_EVENT_MASK.


TEXT_EVENT_MASK

public static final long TEXT_EVENT_MASK
The event mask for selecting text events.

Value 0x400 is assigned to TEXT_EVENT_MASK.


RESERVED_ID_MAX

public static final int RESERVED_ID_MAX
The maximum value for reserved AWT event IDs. Programs defining their own event IDs should use IDs greater than this value.

Value 1999 is assigned to RESERVED_ID_MAX.

Constructor Detail

AWTEvent

public AWTEvent(Event event)
Constructs an AWTEvent object from the parameters of a 1.0-style event.
Parameters:
event - the old-style event

AWTEvent

public AWTEvent(java.lang.Object source,
                int id)
Constructs an AWTEvent object with the specified source object and type.
Parameters:
source - the object where the event originated
Method Detail

getID

public int getID()
Returns the event type.

toString

public java.lang.String toString()
Description copied from class: EventObject
Returns a String representation of this EventObject.
Overrides:
toString in class EventObject
Following copied from class: java.util.EventObject
Returns:
A a String representation of this EventObject.

paramString

public java.lang.String paramString()
Returns a string representing the state of this event. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
Returns:
a string representation of this event.

consume

protected void consume()

isConsumed

protected boolean isConsumed()

finalize

protected void finalize()
                 throws java.lang.Throwable
frees any native data held by this object. Normally called when the object is finalized.

PDAP 1.0 Spec, Rev. 0.16