public class ContainerEvent extends ComponentEvent
ContainerAdapter
,
ContainerListener
,
Serialized FormModifier 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_SHOWN
ACTION_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
source
Constructor and Description |
---|
ContainerEvent(Component source,
int id,
Component child)
Initializes a new instance of
ContainerEvent with the
specified source and id. |
Modifier and Type | Method and Description |
---|---|
Component |
getChild()
This method returns the child object that was added or removed from
the container.
|
Container |
getContainer()
Returns the source of this event as a
Container . |
String |
paramString()
This method returns a string identifying this event.
|
getComponent
getSource
public 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(Component source, int id, 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 eventIllegalArgumentException
- if source is nullpublic Container getContainer()
Container
.ClassCastException
- if the source is changed to a non-Containerpublic Component getChild()
public String paramString()
(getID() == COMPONENT_ADDED ? "COMPONENT_ADDED"
: "COMPONENT_REMOVED") + ",child=" + getChild().getName()
.paramString
in class ComponentEvent