An event which indicates a change to the
Component
hierarchy to which
Component
belongs.
- Hierarchy Change Events (HierarchyListener)
- addition of an ancestor
- removal of an ancestor
- hierarchy made displayable
- hierarchy made undisplayable
- hierarchy shown on the screen (both visible and displayable)
- hierarchy hidden on the screen (either invisible or undisplayable)
- Ancestor Reshape Events (HierarchyBoundsListener)
- an ancestor was resized
- an ancestor was moved
Hierarchy events are provided for notification purposes ONLY. The AWT will automatically handle changes to the hierarchy internally so that GUI layout and displayability works properly regardless of whether a program is receiving these events or not.
This event is generated by a Container object (such as a Panel) when the Container is added, removed, moved, or resized, and passed down the hierarchy. It is also generated by a Component object when that object's addNotify
, removeNotify
, show
, or hide
method is called. The ANCESTOR_MOVED
and ANCESTOR_RESIZED
events are dispatched to every HierarchyBoundsListener
or HierarchyBoundsAdapter
object which registered to receive such events using the Component's addHierarchyBoundsListener
method. (HierarchyBoundsAdapter
objects implement the HierarchyBoundsListener
interface.) The HIERARCHY_CHANGED
events are dispatched to every HierarchyListener
object which registered to receive such events using the Component's addHierarchyListener
method. Each such listener object gets this HierarchyEvent
when the event occurs.
An unspecified behavior will be caused if the id
parameter of any particular HierarchyEvent
instance is not in the range from HIERARCHY_FIRST
to HIERARCHY_LAST
.
The changeFlags
parameter of any HierarchyEvent
instance takes one of the following values:
-
HierarchyEvent.PARENT_CHANGED
-
HierarchyEvent.DISPLAYABILITY_CHANGED
-
HierarchyEvent.SHOWING_CHANGED
Assigning the value different from listed above will cause unspecified behavior.