public class ContainerEvent extends ComponentEvent
ContainerAdapter,
ContainerListener,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static int |
COMPONENT_ADDED
This id indicates a component was added to the container.
|
static int |
COMPONENT_REMOVED
This id indicates a component was removed from the container.
|
static int |
CONTAINER_FIRST
This is the first id in the id range used by this class.
|
static int |
CONTAINER_LAST
This is the last id in the id range used by this class.
|
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWNACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK| Constructor and Description |
|---|
ContainerEvent(java.awt.Component source,
int id,
java.awt.Component child)
Initializes a new instance of
ContainerEvent with the
specified source and id. |
| Modifier and Type | Method and Description |
|---|---|
java.awt.Component |
getChild()
This method returns the child object that was added or removed from
the container.
|
java.awt.Container |
getContainer()
Returns the source of this event as a
Container. |
java.lang.String |
paramString()
This method returns a string identifying this event.
|
getComponentpublic static final int CONTAINER_FIRST
public static final int CONTAINER_LAST
public static final int COMPONENT_ADDED
public static final int COMPONENT_REMOVED
public ContainerEvent(java.awt.Component source, int id, java.awt.Component child)
ContainerEvent with the
specified source and id. Additionally, the affected child component
is also passed as a parameter. Note that an invalid id leads to
unspecified results.source - the source container of the eventid - the event idchild - the child component affected by this eventjava.lang.IllegalArgumentException - if source is nullpublic java.awt.Container getContainer()
Container.java.lang.ClassCastException - if the source is changed to a non-Containerpublic java.awt.Component getChild()
public java.lang.String paramString()
(getID() == COMPONENT_ADDED ? "COMPONENT_ADDED"
: "COMPONENT_REMOVED") + ",child=" + getChild().getName().paramString in class ComponentEvent