java.awt
Class AWTEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--java.awt.AWTEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ActionEvent, AdjustmentEvent, AncestorEvent, AWTRunnerEvent, ComponentEvent, java.awt.EventDispatchThread.EmptyEvent, HierarchyEvent, InputMethodEvent, InternalFrameEvent, InvocationEvent, ItemEvent, javax.swing.SystemEventQueueUtilities.RunnableEvent, SentEvent, SequencedEvent, TextEvent

public abstract class AWTEvent
extends EventObject

Unsafe: 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
Version:
1.48 12/03/01
Author:
Carl Quinn, Amy Fowler
See Also:
Component.enableEvents(long), Toolkit.addAWTEventListener(java.awt.event.AWTEventListener, long), java.awt.event.ActionEvent, java.awt.event.AdjustmentEvent, java.awt.event.ComponentEvent, java.awt.event.ContainerEvent, java.awt.event.FocusEvent, java.awt.event.InputMethodEvent, java.awt.event.InvocationEvent, java.awt.event.ItemEvent, java.awt.event.HierarchyEvent, java.awt.event.KeyEvent, java.awt.event.MouseEvent, java.awt.event.MouseWheelEvent, java.awt.event.PaintEvent, java.awt.event.TextEvent, java.awt.event.WindowEvent, Serialized Form

Field Summary
static long ACTION_EVENT_MASK
          Enabled: The event mask for selecting action events.
static long ADJUSTMENT_EVENT_MASK
          Enabled: The event mask for selecting adjustment events.
private  byte[] bdata
           
static long COMPONENT_EVENT_MASK
          Enabled: The event mask for selecting component events.
protected  boolean consumed
          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
          Enabled: The event mask for selecting container events.
static long FOCUS_EVENT_MASK
          Enabled: The event mask for selecting focus events.
(package private)  boolean focusManagerIsDispatching
           
static long HIERARCHY_BOUNDS_EVENT_MASK
          Enabled: The event mask for selecting hierarchy bounds events.
static long HIERARCHY_EVENT_MASK
          Enabled: The event mask for selecting hierarchy events.
protected  int id
          The event's id.
static long INPUT_METHOD_EVENT_MASK
          Enabled: The event mask for selecting input method events.
(package private) static long INPUT_METHODS_ENABLED_MASK
          The pseudo event mask for enabling input methods.
static long INVOCATION_EVENT_MASK
          Enabled: The event mask for selecting invocation events.
static long ITEM_EVENT_MASK
          Enabled: The event mask for selecting item events.
static long KEY_EVENT_MASK
          Enabled: The event mask for selecting key events.
static long MOUSE_EVENT_MASK
          Enabled: The event mask for selecting mouse events.
static long MOUSE_MOTION_EVENT_MASK
          Enabled: The event mask for selecting mouse motion events.
static long MOUSE_WHEEL_EVENT_MASK
          Enabled: The event mask for selecting mouse wheel events.
static long PAINT_EVENT_MASK
          Enabled: The event mask for selecting paint events.
static int RESERVED_ID_MAX
          Enabled: The maximum value for reserved AWT event IDs.
private static long serialVersionUID
           
static long TEXT_EVENT_MASK
          Enabled: The event mask for selecting text events.
static long WINDOW_EVENT_MASK
          Enabled: The event mask for selecting window events.
static long WINDOW_FOCUS_EVENT_MASK
          Enabled: The event mask for selecting window focus events.
static long WINDOW_STATE_EVENT_MASK
          Enabled: The event mask for selecting window state events.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
AWTEvent(Event event)
          Suppressed: Constructs an AWTEvent object from the parameters of a 1.0-style event.
AWTEvent(Object source, int id)
          Suppressed: Constructs an AWTEvent object with the specified source object and type.
 
Method Summary
protected  void consume()
          Consumes this event, if this event can be consumed.
(package private)  Event convertToOld()
          Converts a new event to an old one (used for compatibility).
(package private)  void copyPrivateDataInto(AWTEvent that)
          Copies all private data from this event into that.
 int getID()
          Suppressed: Returns the event type.
private static void initIDs()
          Initialize JNI field and method IDs for fields that may be accessed from C.
protected  boolean isConsumed()
          Returns whether this event has been consumed.
private  void nativeSetSource(java.awt.peer.ComponentPeer peer)
           
 String paramString()
          Suppressed: Returns a string representing the state of this Event.
 void setSource(Object newSource)
          Suppressed: Retargets an event to a new source.
 String toString()
          Suppressed: Returns a String representation of this object.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bdata

private byte[] bdata

id

protected int id
The event's id.

See Also:
getID(), AWTEvent(java.awt.Event)

consumed

protected boolean consumed
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()

focusManagerIsDispatching

transient boolean focusManagerIsDispatching

COMPONENT_EVENT_MASK

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


CONTAINER_EVENT_MASK

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


FOCUS_EVENT_MASK

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


KEY_EVENT_MASK

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


MOUSE_EVENT_MASK

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


MOUSE_MOTION_EVENT_MASK

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


WINDOW_EVENT_MASK

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


ACTION_EVENT_MASK

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


ADJUSTMENT_EVENT_MASK

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


ITEM_EVENT_MASK

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


TEXT_EVENT_MASK

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


INPUT_METHOD_EVENT_MASK

public static final long INPUT_METHOD_EVENT_MASK
Enabled: The event mask for selecting input method events.


INPUT_METHODS_ENABLED_MASK

static final long INPUT_METHODS_ENABLED_MASK
The pseudo event mask for enabling input methods. We're using one bit in the eventMask so we don't need a separate field inputMethodsEnabled.


PAINT_EVENT_MASK

public static final long PAINT_EVENT_MASK
Enabled: The event mask for selecting paint events.


INVOCATION_EVENT_MASK

public static final long INVOCATION_EVENT_MASK
Enabled: The event mask for selecting invocation events.


HIERARCHY_EVENT_MASK

public static final long HIERARCHY_EVENT_MASK
Enabled: The event mask for selecting hierarchy events.


HIERARCHY_BOUNDS_EVENT_MASK

public static final long HIERARCHY_BOUNDS_EVENT_MASK
Enabled: The event mask for selecting hierarchy bounds events.


MOUSE_WHEEL_EVENT_MASK

public static final long MOUSE_WHEEL_EVENT_MASK
Enabled: The event mask for selecting mouse wheel events.

Since:
1.4

WINDOW_STATE_EVENT_MASK

public static final long WINDOW_STATE_EVENT_MASK
Enabled: The event mask for selecting window state events.

Since:
1.4

WINDOW_FOCUS_EVENT_MASK

public static final long WINDOW_FOCUS_EVENT_MASK
Enabled: The event mask for selecting window focus events.

Since:
1.4

RESERVED_ID_MAX

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


serialVersionUID

private static final long serialVersionUID
Constructor Detail

AWTEvent

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

Parameters:
event - the old-style event

AWTEvent

public AWTEvent(Object source,
                int id)
Suppressed: Constructs an AWTEvent object with the specified source object and type.

Parameters:
source - the object where the event originated
Method Detail

initIDs

private static void initIDs()
Initialize JNI field and method IDs for fields that may be accessed from C.


setSource

public void setSource(Object newSource)
Suppressed: Retargets an event to a new source. This method is typically used to retarget an event to a lightweight child Component of the original heavyweight source.

This method is intended to be used only by event targeting subsystems, such as client-defined KeyboardFocusManagers. It is not for general client use.

Parameters:
newSource - the new Object to which the event should be dispatched

nativeSetSource

private void nativeSetSource(java.awt.peer.ComponentPeer peer)

getID

public int getID()
Suppressed: Returns the event type.


toString

public String toString()
Suppressed: Returns a String representation of this object.

Overrides:
toString in class EventObject
Returns:
A a String representation of this EventObject.

paramString

public String paramString()
Suppressed: 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()
Consumes this event, if this event can be consumed. Only low-level, system events can be consumed


isConsumed

protected boolean isConsumed()
Returns whether this event has been consumed.


convertToOld

Event convertToOld()
Converts a new event to an old one (used for compatibility). If the new event cannot be converted (because no old equivalent exists) then this returns null. Note: this method is here instead of in each individual new event class in java.awt.event because we don't want to make it public and it needs to be called from java.awt.


copyPrivateDataInto

void copyPrivateDataInto(AWTEvent that)
Copies all private data from this event into that. Space is allocated for the copied data that will be freed when the that is finalized. Upon completion, this event is not changed.



comments?