Class HierarchyEvent
- java.lang.Object
-
- java.util.EventObject
-
- java.awt.AWTEvent
-
- java.awt.event.HierarchyEvent
-
- All Implemented Interfaces:
- java.io.Serializable
public class HierarchyEvent extends AWTEventAn event which indicates a change to theComponent
hierarchy to whichComponent
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
, orhide
method is called. TheANCESTOR_MOVED
andANCESTOR_RESIZED
events are dispatched to everyHierarchyBoundsListener
orHierarchyBoundsAdapter
object which registered to receive such events using the Component'saddHierarchyBoundsListener
method. (HierarchyBoundsAdapter
objects implement theHierarchyBoundsListener
interface.) TheHIERARCHY_CHANGED
events are dispatched to everyHierarchyListener
object which registered to receive such events using the Component'saddHierarchyListener
method. Each such listener object gets thisHierarchyEvent
when the event occurs.An unspecified behavior will be caused if the
id
parameter of any particularHierarchyEvent
instance is not in the range fromHIERARCHY_FIRST
toHIERARCHY_LAST
.
ThechangeFlags
parameter of anyHierarchyEvent
instance takes one of the following values:-
HierarchyEvent.PARENT_CHANGED
-
HierarchyEvent.DISPLAYABILITY_CHANGED
-
HierarchyEvent.SHOWING_CHANGED
- Since:
- 1.3
- See Also:
HierarchyListener
,HierarchyBoundsAdapter
,HierarchyBoundsListener
, 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.ANCESTOR_MOVED The event id indicating an ancestor-Container was moved.ANCESTOR_RESIZED The event id indicating an ancestor-Container was resized.COMPONENT_EVENT_MASK The event mask for selecting component events.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.DISPLAYABILITY_CHANGED A change flag indicates that theHIERARCHY_CHANGED
event was generated due to the changing of the hierarchy displayability.FOCUS_EVENT_MASK The event mask for selecting focus events.HIERARCHY_BOUNDS_EVENT_MASK The event mask for selecting hierarchy bounds events.HIERARCHY_CHANGED The event id indicating that modification was made to the entire hierarchy tree.HIERARCHY_EVENT_MASK The event mask for selecting hierarchy events.HIERARCHY_FIRST Marks the first integer id for the range of hierarchy event ids.HIERARCHY_LAST Marks the last integer id for the range of ancestor event ids.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.PARENT_CHANGED A change flag indicates that theHIERARCHY_CHANGED
event was generated by a reparenting operation.RESERVED_ID_MAX The maximum value for reserved AWT event IDs.SHOWING_CHANGED A change flag indicates that theHIERARCHY_CHANGED
event was generated due to the changing of the hierarchy showing state.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.getChanged Returns the Component at the top of the hierarchy which was changed.getChangedParent Returns the parent of the Component returned bygetChanged()
.getChangeFlags Returns a bitmask which indicates the type(s) of HIERARCHY_CHANGED events represented in this event object.getComponent 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.
-