|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.sciss.app.AncestorAdapter
de.sciss.app.DynamicAncestorAdapter
public class DynamicAncestorAdapter
This class can be added as an AncestorListener
and will call the passed DynamicListening
object
when the Component becomes visible or invisible in the
sense that it's ancestor window is shown or hidden.
It's crucial that the addTo
method is
used to register the listener!
Surface
is an example of the use of a
DynamicAncestorAdapter
.
DynamicListening
Field Summary | |
---|---|
protected boolean |
listening
|
Constructor Summary | |
---|---|
DynamicAncestorAdapter(DynamicListening listener)
Constructs a new DynamicAncestorAdapter
which will inform the DynamicListening
about changes in visibility of the ancestor window
of the component to which this adapter is added. |
Method Summary | |
---|---|
void |
addTo(javax.swing.JComponent c)
Adds this adapter to a JComponent . |
void |
ancestorAdded(javax.swing.event.AncestorEvent e)
Called when the tracked component or one of its ancestors gets added in the container hierarchy. |
void |
ancestorRemoved(javax.swing.event.AncestorEvent e)
Called when the tracked component or one of its ancestors gets removed in the container hierarchy. |
javax.swing.JComponent |
getComponent()
|
boolean |
isListening()
|
void |
remove()
|
protected void |
startListening()
|
protected void |
stopListening()
|
Methods inherited from class de.sciss.app.AncestorAdapter |
---|
ancestorMoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean listening
Constructor Detail |
---|
public DynamicAncestorAdapter(DynamicListening listener)
DynamicAncestorAdapter
which will inform the DynamicListening
about changes in visibility of the ancestor window
of the component to which this adapter is added.
listener
- a DynamicListening
whose startListening
method is called when this adapter's
host component's ancestor is shown
or added to another component. the
listener's stopListening
method is called likewise when
this adapter's host component's ancestor
is hidden or removed from its parent.Method Detail |
---|
public void addTo(javax.swing.JComponent c)
JComponent
.
Use this method instead of calling
cmp.addAncestorListener(...)
because this method will automatically detect
the component's window. This is crucial for
JRootPane
components, because they are already
attached to a window when you register the
listener.
c
- the JComponent
who will be tracked for
ancestor changes.JComponent.addAncestorListener( AncestorListener )
public void remove()
public javax.swing.JComponent getComponent()
public boolean isListening()
public void ancestorAdded(javax.swing.event.AncestorEvent e)
startListening
method is invoked.
ancestorAdded
in interface javax.swing.event.AncestorListener
ancestorAdded
in class AncestorAdapter
public void ancestorRemoved(javax.swing.event.AncestorEvent e)
stopListening
method is invoked.
ancestorRemoved
in interface javax.swing.event.AncestorListener
ancestorRemoved
in class AncestorAdapter
protected void startListening()
protected void stopListening()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |