Class ContainerEvent
- java.lang.Object
-
- java.util.EventObject
-
- java.awt.AWTEvent
-
- java.awt.event.ComponentEvent
-
- java.awt.event.ContainerEvent
-
- All Implemented Interfaces:
- java.io.Serializable
public class ContainerEvent extends ComponentEventA low-level event which indicates that a container's contents changed because a component was added or removed.Container events are provided for notification purposes ONLY; The AWT will automatically handle changes to the containers contents internally so that the program works properly regardless of whether the program is receiving these events or not.
This low-level event is generated by a container object (such as a Panel) when a component is added to it or removed from it. The event is passed to every
ContainerListener
orContainerAdapter
object which registered to receive such events using the component'saddContainerListener
method. (ContainerAdapter
objects implement theContainerListener
interface.) Each such listener object gets thisContainerEvent
when the event occurs.An unspecified behavior will be caused if the
id
parameter of any particularContainerEvent
instance is not in the range fromCONTAINER_FIRST
toCONTAINER_LAST
.- Since:
- 1.1
- See Also:
ContainerAdapter
,ContainerListener
, Tutorial: Writing a Container 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_ADDED This event indicates that a component was added to the container.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_REMOVED This event indicates that a component was removed from the container.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.CONTAINER_FIRST The first number in the range of ids used for container events.CONTAINER_LAST The last number in the range of ids used for 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.getChild Returns the component that was affected by the event.getComponent Returns the originator of the event.getContainer 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.
-