public abstract class

AWTEvent

extends EventObject
java.lang.Object
   ↳ java.util.EventObject
     ↳ java.awt.AWTEvent
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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.

Summary

Constants
long ACTION_EVENT_MASK The event mask for selecting action events.
long ADJUSTMENT_EVENT_MASK The event mask for selecting adjustment events.
long COMPONENT_EVENT_MASK The event mask for selecting component events.
long CONTAINER_EVENT_MASK The event mask for selecting container events.
long FOCUS_EVENT_MASK The event mask for selecting focus events.
long HIERARCHY_BOUNDS_EVENT_MASK The event mask for selecting hierarchy bounds events.
long HIERARCHY_EVENT_MASK The event mask for selecting hierarchy events.
long INPUT_METHOD_EVENT_MASK The event mask for selecting input method events.
long INVOCATION_EVENT_MASK The event mask for selecting invocation events.
long ITEM_EVENT_MASK The event mask for selecting item events.
long KEY_EVENT_MASK The event mask for selecting key events.
long MOUSE_EVENT_MASK The event mask for selecting mouse events.
long MOUSE_MOTION_EVENT_MASK The event mask for selecting mouse motion events.
long MOUSE_WHEEL_EVENT_MASK The event mask for selecting mouse wheel events.
long PAINT_EVENT_MASK The event mask for selecting paint events.
int RESERVED_ID_MAX The maximum value for reserved AWT event IDs.
long TEXT_EVENT_MASK The event mask for selecting text events.
long WINDOW_EVENT_MASK The event mask for selecting window events.
long WINDOW_FOCUS_EVENT_MASK The event mask for selecting window focus events.
long WINDOW_STATE_EVENT_MASK The event mask for selecting window state events.
Fields
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.
protected int id The event's id.@serial
[Expand]
Inherited Fields
From class java.util.EventObject
Public Constructors
AWTEvent(Event event)
Constructs an AWTEvent object from the parameters of a 1.0-style event.
AWTEvent(Object source, int id)
Constructs an AWTEvent object with the specified source object and type.
Public Methods
int getID()
Returns the event type.
String paramString()
Returns a string representing the state of this Event.
void setSource(Object newSource)
Retargets an event to a new source.
String toString()
Returns a String representation of this object.
Protected Methods
void consume()
Consumes this event, if this event can be consumed.
boolean isConsumed()
Returns whether this event has been consumed.
[Expand]
Inherited Methods
From class java.util.EventObject
From class java.lang.Object

Constants

public static final long ACTION_EVENT_MASK

The event mask for selecting action events.

Constant Value: 128 (0x0000000000000080)

public static final long ADJUSTMENT_EVENT_MASK

The event mask for selecting adjustment events.

Constant Value: 256 (0x0000000000000100)

public static final long COMPONENT_EVENT_MASK

The event mask for selecting component events.

Constant Value: 1 (0x0000000000000001)

public static final long CONTAINER_EVENT_MASK

The event mask for selecting container events.

Constant Value: 2 (0x0000000000000002)

public static final long FOCUS_EVENT_MASK

The event mask for selecting focus events.

Constant Value: 4 (0x0000000000000004)

public static final long HIERARCHY_BOUNDS_EVENT_MASK

The event mask for selecting hierarchy bounds events.

Constant Value: 65536 (0x0000000000010000)

public static final long HIERARCHY_EVENT_MASK

The event mask for selecting hierarchy events.

Constant Value: 32768 (0x0000000000008000)

public static final long INPUT_METHOD_EVENT_MASK

The event mask for selecting input method events.

Constant Value: 2048 (0x0000000000000800)

public static final long INVOCATION_EVENT_MASK

The event mask for selecting invocation events.

Constant Value: 16384 (0x0000000000004000)

public static final long ITEM_EVENT_MASK

The event mask for selecting item events.

Constant Value: 512 (0x0000000000000200)

public static final long KEY_EVENT_MASK

The event mask for selecting key events.

Constant Value: 8 (0x0000000000000008)

public static final long MOUSE_EVENT_MASK

The event mask for selecting mouse events.

Constant Value: 16 (0x0000000000000010)

public static final long MOUSE_MOTION_EVENT_MASK

The event mask for selecting mouse motion events.

Constant Value: 32 (0x0000000000000020)

public static final long MOUSE_WHEEL_EVENT_MASK

The event mask for selecting mouse wheel events.

Constant Value: 131072 (0x0000000000020000)

public static final long PAINT_EVENT_MASK

The event mask for selecting paint events.

Constant Value: 8192 (0x0000000000002000)

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.

Constant Value: 1999 (0x000007cf)

public static final long TEXT_EVENT_MASK

The event mask for selecting text events.

Constant Value: 1024 (0x0000000000000400)

public static final long WINDOW_EVENT_MASK

The event mask for selecting window events.

Constant Value: 64 (0x0000000000000040)

public static final long WINDOW_FOCUS_EVENT_MASK

The event mask for selecting window focus events.

Constant Value: 524288 (0x0000000000080000)

public static final long WINDOW_STATE_EVENT_MASK

The event mask for selecting window state events.

Constant Value: 262144 (0x0000000000040000)

Fields

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.@serial

protected int id

The event's id.@serial

Public Constructors

public AWTEvent (Event event)

Constructs an AWTEvent object from the parameters of a 1.0-style event.

Parameters
event the old-style event

public AWTEvent (Object source, int id)

Constructs an AWTEvent object with the specified source object and type.

Parameters
source the object where the event originated
id the event type

Public Methods

public int getID ()

Returns the event type.

public 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

public void setSource (Object newSource)

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

public String toString ()

Returns a String representation of this object.

Returns
  • A a String representation of this EventObject.

Protected Methods

protected void consume ()

Consumes this event, if this event can be consumed. Only low-level, system events can be consumed

protected boolean isConsumed ()

Returns whether this event has been consumed.