java.awt
Class AWTEvent

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject 
      extended by java.awt.AWTEvent
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable
Direct Known Subclasses:
ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , AdjustmentEvent sample code for java.awt.event.AdjustmentEvent definition code for java.awt.event.AdjustmentEvent , AncestorEvent sample code for javax.swing.event.AncestorEvent definition code for javax.swing.event.AncestorEvent , ComponentEvent sample code for java.awt.event.ComponentEvent definition code for java.awt.event.ComponentEvent , HierarchyEvent sample code for java.awt.event.HierarchyEvent definition code for java.awt.event.HierarchyEvent , InputMethodEvent sample code for java.awt.event.InputMethodEvent definition code for java.awt.event.InputMethodEvent , InternalFrameEvent sample code for javax.swing.event.InternalFrameEvent definition code for javax.swing.event.InternalFrameEvent , InvocationEvent sample code for java.awt.event.InvocationEvent definition code for java.awt.event.InvocationEvent , ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , TextEvent sample code for java.awt.event.TextEvent definition code for java.awt.event.TextEvent

public abstract class AWTEvent
extends EventObject sample code for java.util.EventObject definition code for java.util.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) sample code for java.awt.Component.enableEvents(long) definition code for java.awt.Component.enableEvents(long) , Toolkit.addAWTEventListener(java.awt.event.AWTEventListener, long) sample code for java.awt.Toolkit.addAWTEventListener(java.awt.event.AWTEventListener, long) definition code for java.awt.Toolkit.addAWTEventListener(java.awt.event.AWTEventListener, long) , ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , AdjustmentEvent sample code for java.awt.event.AdjustmentEvent definition code for java.awt.event.AdjustmentEvent , ComponentEvent sample code for java.awt.event.ComponentEvent definition code for java.awt.event.ComponentEvent , ContainerEvent sample code for java.awt.event.ContainerEvent definition code for java.awt.event.ContainerEvent , FocusEvent sample code for java.awt.event.FocusEvent definition code for java.awt.event.FocusEvent , InputMethodEvent sample code for java.awt.event.InputMethodEvent definition code for java.awt.event.InputMethodEvent , InvocationEvent sample code for java.awt.event.InvocationEvent definition code for java.awt.event.InvocationEvent , ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , HierarchyEvent sample code for java.awt.event.HierarchyEvent definition code for java.awt.event.HierarchyEvent , KeyEvent sample code for java.awt.event.KeyEvent definition code for java.awt.event.KeyEvent , MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent , MouseWheelEvent sample code for java.awt.event.MouseWheelEvent definition code for java.awt.event.MouseWheelEvent , PaintEvent sample code for java.awt.event.PaintEvent definition code for java.awt.event.PaintEvent , TextEvent sample code for java.awt.event.TextEvent definition code for java.awt.event.TextEvent , WindowEvent sample code for java.awt.event.WindowEvent definition code for java.awt.event.WindowEvent , Serialized Form

Field Summary
static long ACTION_EVENT_MASK sample code for java.awt.AWTEvent.ACTION_EVENT_MASK definition code for java.awt.AWTEvent.ACTION_EVENT_MASK
          The event mask for selecting action events.
static long ADJUSTMENT_EVENT_MASK sample code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK definition code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK
          The event mask for selecting adjustment events.
static long COMPONENT_EVENT_MASK sample code for java.awt.AWTEvent.COMPONENT_EVENT_MASK definition code for java.awt.AWTEvent.COMPONENT_EVENT_MASK
          The event mask for selecting component events.
protected  boolean consumed sample code for java.awt.AWTEvent.consumed definition code for java.awt.AWTEvent.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 sample code for java.awt.AWTEvent.CONTAINER_EVENT_MASK definition code for java.awt.AWTEvent.CONTAINER_EVENT_MASK
          The event mask for selecting container events.
static long FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.FOCUS_EVENT_MASK definition code for java.awt.AWTEvent.FOCUS_EVENT_MASK
          The event mask for selecting focus events.
static long HIERARCHY_BOUNDS_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK definition code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK
          The event mask for selecting hierarchy bounds events.
static long HIERARCHY_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK definition code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK
          The event mask for selecting hierarchy events.
protected  int id sample code for java.awt.AWTEvent.id definition code for java.awt.AWTEvent.id
          The event's id.
static long INPUT_METHOD_EVENT_MASK sample code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK definition code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK
          The event mask for selecting input method events.
static long INVOCATION_EVENT_MASK sample code for java.awt.AWTEvent.INVOCATION_EVENT_MASK definition code for java.awt.AWTEvent.INVOCATION_EVENT_MASK
          The event mask for selecting invocation events.
static long ITEM_EVENT_MASK sample code for java.awt.AWTEvent.ITEM_EVENT_MASK definition code for java.awt.AWTEvent.ITEM_EVENT_MASK
          The event mask for selecting item events.
static long KEY_EVENT_MASK sample code for java.awt.AWTEvent.KEY_EVENT_MASK definition code for java.awt.AWTEvent.KEY_EVENT_MASK
          The event mask for selecting key events.
static long MOUSE_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_EVENT_MASK
          The event mask for selecting mouse events.
static long MOUSE_MOTION_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK
          The event mask for selecting mouse motion events.
static long MOUSE_WHEEL_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK
          The event mask for selecting mouse wheel events.
static long PAINT_EVENT_MASK sample code for java.awt.AWTEvent.PAINT_EVENT_MASK definition code for java.awt.AWTEvent.PAINT_EVENT_MASK
          The event mask for selecting paint events.
static int RESERVED_ID_MAX sample code for java.awt.AWTEvent.RESERVED_ID_MAX definition code for java.awt.AWTEvent.RESERVED_ID_MAX
          The maximum value for reserved AWT event IDs.
static long TEXT_EVENT_MASK sample code for java.awt.AWTEvent.TEXT_EVENT_MASK definition code for java.awt.AWTEvent.TEXT_EVENT_MASK
          The event mask for selecting text events.
static long WINDOW_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_EVENT_MASK
          The event mask for selecting window events.
static long WINDOW_FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK
          The event mask for selecting window focus events.
static long WINDOW_STATE_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK
          The event mask for selecting window state events.
 
Fields inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
source sample code for java.util.EventObject.source definition code for java.util.EventObject.source
 
Constructor Summary
AWTEvent sample code for java.awt.AWTEvent.AWTEvent(java.awt.Event) definition code for java.awt.AWTEvent.AWTEvent(java.awt.Event) (Event sample code for java.awt.Event definition code for java.awt.Event  event)
          Constructs an AWTEvent object from the parameters of a 1.0-style event.
AWTEvent sample code for java.awt.AWTEvent.AWTEvent(java.lang.Object, int) definition code for java.awt.AWTEvent.AWTEvent(java.lang.Object, int) (Object sample code for java.lang.Object definition code for java.lang.Object  source, int id)
          Constructs an AWTEvent object with the specified source object and type.
 
Method Summary
protected  void consume sample code for java.awt.AWTEvent.consume() definition code for java.awt.AWTEvent.consume() ()
          Consumes this event, if this event can be consumed.
 int getID sample code for java.awt.AWTEvent.getID() definition code for java.awt.AWTEvent.getID() ()
          Returns the event type.
protected  boolean isConsumed sample code for java.awt.AWTEvent.isConsumed() definition code for java.awt.AWTEvent.isConsumed() ()
          Returns whether this event has been consumed.
 String sample code for java.lang.String definition code for java.lang.String paramString sample code for java.awt.AWTEvent.paramString() definition code for java.awt.AWTEvent.paramString() ()
          Returns a string representing the state of this Event.
 void setSource sample code for java.awt.AWTEvent.setSource(java.lang.Object) definition code for java.awt.AWTEvent.setSource(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  newSource)
          Retargets an event to a new source.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.AWTEvent.toString() definition code for java.awt.AWTEvent.toString() ()
          Returns a String representation of this object.
 
Methods inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
getSource sample code for java.util.EventObject.getSource() definition code for java.util.EventObject.getSource()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

id sample code for java.awt.AWTEvent.id

protected int id
The event's id.

See Also:
getID() sample code for java.awt.AWTEvent.getID() definition code for java.awt.AWTEvent.getID() , AWTEvent(java.lang.Object, int) sample code for java.awt.AWTEvent.AWTEvent(java.lang.Object, int) definition code for java.awt.AWTEvent.AWTEvent(java.lang.Object, int)

consumed sample code for java.awt.AWTEvent.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() sample code for java.awt.AWTEvent.consume() definition code for java.awt.AWTEvent.consume() , isConsumed() sample code for java.awt.AWTEvent.isConsumed() definition code for java.awt.AWTEvent.isConsumed()

COMPONENT_EVENT_MASK sample code for java.awt.AWTEvent.COMPONENT_EVENT_MASK

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

See Also:
Constant Field Values

CONTAINER_EVENT_MASK sample code for java.awt.AWTEvent.CONTAINER_EVENT_MASK

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

See Also:
Constant Field Values

FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.FOCUS_EVENT_MASK

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

See Also:
Constant Field Values

KEY_EVENT_MASK sample code for java.awt.AWTEvent.KEY_EVENT_MASK

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

See Also:
Constant Field Values

MOUSE_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_EVENT_MASK

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

See Also:
Constant Field Values

MOUSE_MOTION_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK

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

See Also:
Constant Field Values

WINDOW_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_EVENT_MASK

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

See Also:
Constant Field Values

ACTION_EVENT_MASK sample code for java.awt.AWTEvent.ACTION_EVENT_MASK

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

See Also:
Constant Field Values

ADJUSTMENT_EVENT_MASK sample code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK

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

See Also:
Constant Field Values

ITEM_EVENT_MASK sample code for java.awt.AWTEvent.ITEM_EVENT_MASK

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

See Also:
Constant Field Values

TEXT_EVENT_MASK sample code for java.awt.AWTEvent.TEXT_EVENT_MASK

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

See Also:
Constant Field Values

INPUT_METHOD_EVENT_MASK sample code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK

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

See Also:
Constant Field Values

PAINT_EVENT_MASK sample code for java.awt.AWTEvent.PAINT_EVENT_MASK

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

See Also:
Constant Field Values

INVOCATION_EVENT_MASK sample code for java.awt.AWTEvent.INVOCATION_EVENT_MASK

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

See Also:
Constant Field Values

HIERARCHY_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK

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

See Also:
Constant Field Values

HIERARCHY_BOUNDS_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK

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

See Also:
Constant Field Values

MOUSE_WHEEL_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK

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

Since:
1.4
See Also:
Constant Field Values

WINDOW_STATE_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK

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

Since:
1.4
See Also:
Constant Field Values

WINDOW_FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK

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

Since:
1.4
See Also:
Constant Field Values

RESERVED_ID_MAX sample code for java.awt.AWTEvent.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.

See Also:
Constant Field Values
Constructor Detail

AWTEvent sample code for java.awt.AWTEvent(java.awt.Event) definition code for java.awt.AWTEvent(java.awt.Event)

public AWTEvent(Event sample code for java.awt.Event definition code for java.awt.Event  event)
Constructs an AWTEvent object from the parameters of a 1.0-style event.

Parameters:
event - the old-style event

AWTEvent sample code for java.awt.AWTEvent(java.lang.Object, int) definition code for java.awt.AWTEvent(java.lang.Object, int)

public AWTEvent(Object sample code for java.lang.Object definition code for 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

setSource sample code for java.awt.AWTEvent.setSource(java.lang.Object) definition code for java.awt.AWTEvent.setSource(java.lang.Object)

public void setSource(Object sample code for java.lang.Object definition code for java.lang.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

getID sample code for java.awt.AWTEvent.getID() definition code for java.awt.AWTEvent.getID()

public int getID()
Returns the event type.


toString sample code for java.awt.AWTEvent.toString() definition code for java.awt.AWTEvent.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a String representation of this object.

Overrides:
toString sample code for java.util.EventObject.toString() definition code for java.util.EventObject.toString() in class EventObject sample code for java.util.EventObject definition code for java.util.EventObject
Returns:
A a String representation of this EventObject.

paramString sample code for java.awt.AWTEvent.paramString() definition code for java.awt.AWTEvent.paramString()

public String sample code for java.lang.String definition code for 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 sample code for java.awt.AWTEvent.consume() definition code for java.awt.AWTEvent.consume()

protected void consume()
Consumes this event, if this event can be consumed. Only low-level, system events can be consumed


isConsumed sample code for java.awt.AWTEvent.isConsumed() definition code for java.awt.AWTEvent.isConsumed()

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