Class ComponentEvent
- java.lang.Object
-
- java.util.EventObject
-
- java.awt.AWTEvent
-
- java.awt.event.ComponentEvent
-
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- ContainerEvent, FocusEvent, InputEvent, PaintEvent, WindowEvent
public class ComponentEvent extends AWTEventA low-level event which indicates that a component moved, changed size, or changed visibility (also, the root class for the other component-level events).Component events are provided for notification purposes ONLY; The AWT will automatically handle component moves and resizes internally so that GUI layout works properly regardless of whether a program is receiving these events or not.
In addition to serving as the base class for other component-related events (InputEvent, FocusEvent, WindowEvent, ContainerEvent), this class defines the events that indicate changes in a component's size, position, or visibility.
This low-level event is generated by a component object (such as a List) when the component is moved, resized, rendered invisible, or made visible again. The event is passed to every
ComponentListenerorComponentAdapterobject which registered to receive such events using the component'saddComponentListenermethod. (ComponentAdapterobjects implement theComponentListenerinterface.) Each such listener object gets thisComponentEventwhen the event occurs.An unspecified behavior will be caused if the
idparameter of any particularComponentEventinstance is not in the range fromCOMPONENT_FIRSTtoCOMPONENT_LAST.- Since:
- 1.1
- See Also:
ComponentAdapter,ComponentListener, Tutorial: Writing a Component Listener, Serialized Form
-
-
Fields Modifier and Type Field and Description 
ACTION_EVENT_MASK 
The event mask for selecting action events.
ADJUSTMENT_EVENT_MASK 
The event mask for selecting adjustment events.
COMPONENT_EVENT_MASK 
The event mask for selecting component events.
COMPONENT_FIRST 
The first number in the range of ids used for component events.
COMPONENT_HIDDEN 
This event indicates that the component was rendered invisible.
COMPONENT_LAST 
The last number in the range of ids used for component events.
COMPONENT_MOVED 
This event indicates that the component's position changed.
COMPONENT_RESIZED 
This event indicates that the component's size changed.
COMPONENT_SHOWN 
This event indicates that the component was made visible.
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.
CONTAINER_EVENT_MASK 
The event mask for selecting container events.
FOCUS_EVENT_MASK 
The event mask for selecting focus events.
HIERARCHY_BOUNDS_EVENT_MASK 
The event mask for selecting hierarchy bounds events.
HIERARCHY_EVENT_MASK 
The event mask for selecting hierarchy events.
id 
The event's id.
INPUT_METHOD_EVENT_MASK 
The event mask for selecting input method events.
INVOCATION_EVENT_MASK 
The event mask for selecting invocation events.
ITEM_EVENT_MASK 
The event mask for selecting item events.
KEY_EVENT_MASK 
The event mask for selecting key events.
MOUSE_EVENT_MASK 
The event mask for selecting mouse events.
MOUSE_MOTION_EVENT_MASK 
The event mask for selecting mouse motion events.
MOUSE_WHEEL_EVENT_MASK 
The event mask for selecting mouse wheel events.
PAINT_EVENT_MASK 
The event mask for selecting paint events.
RESERVED_ID_MAX 
The maximum value for reserved AWT event IDs.
source 
The object on which the Event initially occurred.
TEXT_EVENT_MASK 
The event mask for selecting text events.
WINDOW_EVENT_MASK 
The event mask for selecting window events.
WINDOW_FOCUS_EVENT_MASK 
The event mask for selecting window focus events.
WINDOW_STATE_EVENT_MASK 
The event mask for selecting window state events.
-
Methods Modifier and Type Method and Description 
consume 
Consumes this event, if this event can be consumed.
getComponent 
Returns the originator of the event.
getID 
Returns the event type.
getSource 
The object on which the Event initially occurred.
isConsumed 
Returns whether this event has been consumed.
paramString 
Returns a parameter string identifying this event.
setSource 
Retargets an event to a new source.
toString 
Returns a String representation of this object.
-
