Serializable
ActionEvent
, AdjustmentEvent
, AncestorEvent
, ComponentEvent
, HierarchyEvent
, InputMethodEvent
, InternalFrameEvent
, InvocationEvent
, ItemEvent
, TextEvent
public abstract class AWTEvent extends EventObject
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.
Modifier and Type | Field | Description |
---|---|---|
static final long |
ACTION_EVENT_MASK |
The event mask for selecting action events. |
static final long |
ADJUSTMENT_EVENT_MASK |
The event mask for selecting adjustment events. |
static final long |
COMPONENT_EVENT_MASK |
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 final long |
CONTAINER_EVENT_MASK |
The event mask for selecting container events. |
static final long |
FOCUS_EVENT_MASK |
The event mask for selecting focus events. |
static final long |
HIERARCHY_BOUNDS_EVENT_MASK |
The event mask for selecting hierarchy bounds events. |
static final long |
HIERARCHY_EVENT_MASK |
The event mask for selecting hierarchy events. |
protected int |
id |
The event's id. |
static final long |
INPUT_METHOD_EVENT_MASK |
The event mask for selecting input method events. |
static final long |
INVOCATION_EVENT_MASK |
The event mask for selecting invocation events. |
static final long |
ITEM_EVENT_MASK |
The event mask for selecting item events. |
static final long |
KEY_EVENT_MASK |
The event mask for selecting key events. |
static final long |
MOUSE_EVENT_MASK |
The event mask for selecting mouse events. |
static final long |
MOUSE_MOTION_EVENT_MASK |
The event mask for selecting mouse motion events. |
static final long |
MOUSE_WHEEL_EVENT_MASK |
The event mask for selecting mouse wheel events. |
static final long |
PAINT_EVENT_MASK |
The event mask for selecting paint events. |
static final int |
RESERVED_ID_MAX |
The maximum value for reserved AWT event IDs. |
static final long |
TEXT_EVENT_MASK |
The event mask for selecting text events. |
static final long |
WINDOW_EVENT_MASK |
The event mask for selecting window events. |
static final long |
WINDOW_FOCUS_EVENT_MASK |
The event mask for selecting window focus events. |
static final long |
WINDOW_STATE_EVENT_MASK |
The event mask for selecting window state events. |
source
Constructor | Description |
---|---|
AWTEvent |
Deprecated. |
AWTEvent |
Constructs an AWTEvent object with the specified source object and type. |
Modifier and Type | Method | Description |
---|---|---|
protected void |
consume() |
Consumes this event, if this event can be consumed. |
int |
getID() |
Returns the event type. |
protected boolean |
isConsumed() |
Returns whether this event has been consumed. |
String |
paramString() |
Returns a string representing the state of this Event . |
void |
setSource |
Retargets an event to a new source. |
String |
toString() |
Returns a String representation of this object. |
getSource
protected int id
protected boolean consumed
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 KEY_EVENT_MASK
public static final long MOUSE_EVENT_MASK
public static final long MOUSE_MOTION_EVENT_MASK
public static final long WINDOW_EVENT_MASK
public static final long ACTION_EVENT_MASK
public static final long ADJUSTMENT_EVENT_MASK
public static final long ITEM_EVENT_MASK
public static final long TEXT_EVENT_MASK
public static final long INPUT_METHOD_EVENT_MASK
public static final long PAINT_EVENT_MASK
public static final long INVOCATION_EVENT_MASK
public static final long HIERARCHY_EVENT_MASK
public static final long HIERARCHY_BOUNDS_EVENT_MASK
public static final long MOUSE_WHEEL_EVENT_MASK
public static final long WINDOW_STATE_EVENT_MASK
public static final long WINDOW_FOCUS_EVENT_MASK
public static final int RESERVED_ID_MAX
@Deprecated(since="9") public AWTEvent(Event event)
AWTEvent(Object, int)
be used insteadevent
- the old-style eventpublic AWTEvent(Object source, int id)
source
- the object where the event originatedid
- the event typepublic void setSource(Object newSource)
This method is intended to be used only by event targeting subsystems, such as client-defined KeyboardFocusManagers. It is not for general client use.
newSource
- the new Object to which the event should be dispatchedpublic int getID()
public String toString()
toString
in class EventObject
public String paramString()
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
.protected void consume()
protected boolean isConsumed()
true
if this event has been consumed; otherwise false
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/awt/AWTEvent.html
AWTEvent(Object, int)
be used instead