APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.event

public Class AncestorEvent

extends AWTEvent
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.awt.event.*, java.awt.*, javax.swing.*

An event reported to a child component that originated from an ancestor in the component hierarchy.

Warning

Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
Dave Moore

Field Summary

Modifier and TypeField and Description
pack-priv Container
public static final int
ANCESTOR_ADDED

An ancestor-component was added to the hierarchy of visible objects (made visible), and is currently being displayed.

public static final int
ANCESTOR_MOVED

An ancestor-component changed its position on the screen.

public static final int
ANCESTOR_REMOVED

An ancestor-component was removed from the hierarchy of visible objects (hidden) and is no longer being displayed.

pack-priv Container
Inherited from java.awt.AWTEvent:
ACTION_EVENT_MASKADJUSTMENT_EVENT_MASKCOMPONENT_EVENT_MASKconsumedCONTAINER_EVENT_MASKFOCUS_EVENT_MASKHIERARCHY_BOUNDS_EVENT_MASKHIERARCHY_EVENT_MASKidINPUT_METHOD_EVENT_MASKINVOCATION_EVENT_MASKITEM_EVENT_MASKKEY_EVENT_MASKMOUSE_EVENT_MASKMOUSE_MOTION_EVENT_MASKMOUSE_WHEEL_EVENT_MASKPAINT_EVENT_MASKRESERVED_ID_MAXTEXT_EVENT_MASKWINDOW_EVENT_MASKWINDOW_FOCUS_EVENT_MASKWINDOW_STATE_EVENT_MASK

Constructor Summary

AccessConstructor and Description
public
AncestorEvent(JComponent
the JComponent that originated the event (typically this)
source
,
int id, Container
a Container object specifying the ancestor-component whose display-status changed
ancestor
,
Container
a Container object specifying the ancestor's parent
ancestorParent
)

Constructs an AncestorEvent object to identify a change in an ancestor-component's display-status.

Method Summary

Modifier and TypeMethod and Description
public Container

Returns:

the Container object specifying the ancestor component
getAncestor
()

Returns the ancestor that the event actually occurred on.

public Container

Returns:

the Container object specifying the ancestor's parent
getAncestorParent
()

Returns the parent of the ancestor the event actually occurred on.

public JComponent

Returns:

the JComponent on which the event occurred
getComponent
()

Returns the component that the listener was added to.

Inherited from java.awt.AWTEvent:
consumegetIDisConsumedparamStringsetSourcetoString

Field Detail

ancestorback to summary
pack-priv Container ancestor
ANCESTOR_ADDEDback to summary
public static final int ANCESTOR_ADDED

An ancestor-component was added to the hierarchy of visible objects (made visible), and is currently being displayed.

ANCESTOR_MOVEDback to summary
public static final int ANCESTOR_MOVED

An ancestor-component changed its position on the screen.

ANCESTOR_REMOVEDback to summary
public static final int ANCESTOR_REMOVED

An ancestor-component was removed from the hierarchy of visible objects (hidden) and is no longer being displayed.

ancestorParentback to summary
pack-priv Container ancestorParent

Constructor Detail

AncestorEventback to summary
public AncestorEvent(JComponent source, int id, Container ancestor, Container ancestorParent)

Constructs an AncestorEvent object to identify a change in an ancestor-component's display-status.

Parameters
source:JComponent

the JComponent that originated the event (typically this)

id:int

an int specifying ANCESTOR_ADDED, ANCESTOR_REMOVED or ANCESTOR_MOVED

ancestor:Container

a Container object specifying the ancestor-component whose display-status changed

ancestorParent:Container

a Container object specifying the ancestor's parent

Method Detail

getAncestorback to summary
public Container getAncestor()

Returns the ancestor that the event actually occurred on.

Returns:Container

the Container object specifying the ancestor component

getAncestorParentback to summary
public Container getAncestorParent()

Returns the parent of the ancestor the event actually occurred on. This is most interesting in an ANCESTOR_REMOVED event, as the ancestor may no longer be in the component hierarchy.

Returns:Container

the Container object specifying the ancestor's parent

getComponentback to summary
public JComponent getComponent()

Returns the component that the listener was added to.

Returns:JComponent

the JComponent on which the event occurred