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
ComponentListener
orComponentAdapter
object which registered to receive such events using the component'saddComponentListener
method. (ComponentAdapter
objects implement theComponentListener
interface.) Each such listener object gets thisComponentEvent
when the event occurs.An unspecified behavior will be caused if the
id
parameter of any particularComponentEvent
instance is not in the range fromCOMPONENT_FIRST
toCOMPONENT_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.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.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.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 getComponent Returns the originator of the event.getID Returns the event type.getSource The object on which the Event initially occurred.paramString Returns a parameter string identifying this event.setSource Retargets an event to a new source.toString Returns a String representation of this object.
-