SWING - AWTEvent Class



It is the root event class for all AWTEvent events. This class and its subclasses supercede the original java.awt.Event class. This class is defined in java.awt package. This class has a method named getID() that can be used to determine the type of event.

Class Declaration

Following is the declaration for java.awt.AWTEvent class −

public class AWTEvent
   extends EventObject

Field

Following are the fields for java.awt.AWTEvent class −

  • static int ACTION_FIRST − The first number in the range of IDs used for action events.

  • 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 − 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.

  • static long HIERARCHY_BOUNDS_EVENT_MASK − The event mask for selecting hierarchy bounds events.

  • static long HIERARCHY_EVENT_MASK − The event mask for selecting hierarchy events.

  • protected int id − The event's ID.

  • static long INPUT_METHOD_EVENT_MASK − The event mask for selecting input method events.

  • static long INVOCATION_EVENT_MASK − The event mask for selecting invocation events.

  • 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 long MOUSE_WHEEL_EVENT_MASK − The event mask for selecting mouse wheel events.

  • static long PAINT_EVENT_MASK − The event mask for selecting paint events.

  • static int RESERVED_ID_MAX − The maximum value for reserved SWING 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.

  • static long WINDOW_FOCUS_EVENT_MASK − The event mask for selecting window focus events.

  • static long WINDOW_STATE_EVENT_MASK − The event mask for selecting window state events.

Class Constructors

Sr.No. Constructor & Description
1

AWTEvent(Event event)

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

2

AWTEvent(java.lang.Object source, int id)

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

Class Methods

Sr.No. Method & Description
1

protected void consume()

Consumes this event, if this event can be consumed.

2

int getID()

Returns the event type.

3

protected boolean isConsumed()

Returns whether this event has been consumed.

4

java.lang.String paramString()

Returns a string representing the state of this Event.

5

void setSource(java.lang.Object newSource)

Retargets an event to a new source.

6

java.lang.String toString()

Returns a String representation of this object.

Methods Inherited

This class inherits methods from the following classes −

  • java.util.EventObject
  • java.lang.Object
swing_event_classes.htm
Advertisements