本文整理匯總了Java中javax.swing.event.AncestorListener類的典型用法代碼示例。如果您正苦於以下問題:Java AncestorListener類的具體用法?Java AncestorListener怎麽用?Java AncestorListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AncestorListener類屬於javax.swing.event包,在下文中一共展示了AncestorListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
/**
* Maps {@code JComponent.addAncestorListener(AncestorListener)}
* through queue
*/
public void addAncestorListener(final AncestorListener ancestorListener) {
runMapping(new MapVoidAction("addAncestorListener") {
@Override
public void map() {
((JComponent) getSource()).addAncestorListener(ancestorListener);
}
});
}
示例2: removeAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
/**
* Maps {@code JComponent.removeAncestorListener(AncestorListener)}
* through queue
*/
public void removeAncestorListener(final AncestorListener ancestorListener) {
runMapping(new MapVoidAction("removeAncestorListener") {
@Override
public void map() {
((JComponent) getSource()).removeAncestorListener(ancestorListener);
}
});
}
示例3: fireAncestorEvent
import javax.swing.event.AncestorListener; //導入依賴的package包/類
/**
* Fires an AncestorEvent to this component's and all of its child
* component's AncestorListeners.
*
* @param ancestor the component that triggered the event
* @param id the kind of ancestor event that should be fired
*/
void fireAncestorEvent(JComponent ancestor, int id)
{
// Fire event for registered ancestor listeners of this component.
AncestorListener[] listeners = getAncestorListeners();
if (listeners.length > 0)
{
AncestorEvent ev = new AncestorEvent(this, id,
ancestor, ancestor.getParent());
for (int i = 0; i < listeners.length; i++)
{
switch (id)
{
case AncestorEvent.ANCESTOR_MOVED:
listeners[i].ancestorMoved(ev);
break;
case AncestorEvent.ANCESTOR_ADDED:
listeners[i].ancestorAdded(ev);
break;
case AncestorEvent.ANCESTOR_REMOVED:
listeners[i].ancestorRemoved(ev);
break;
}
}
}
// Dispatch event to all children.
int numChildren = getComponentCount();
for (int i = 0; i < numChildren; i++)
{
Component child = getComponent(i);
if (! (child instanceof JComponent))
continue;
JComponent jc = (JComponent) child;
jc.fireAncestorEvent(ancestor, id);
}
}
示例4: fireAncestorEvent
import javax.swing.event.AncestorListener; //導入依賴的package包/類
private void fireAncestorEvent(int eventID, Container ancestor, Container ancestorParent) {
final AncestorListener[] listeners = getAncestorListeners();
AncestorEvent ancestorEvent = new AncestorEvent(JComponent.this, eventID, ancestor,
ancestorParent);
for (int i = 0; i < listeners.length; i++) {
if (eventID == AncestorEvent.ANCESTOR_ADDED) {
listeners[i].ancestorAdded(ancestorEvent);
} else if (eventID == AncestorEvent.ANCESTOR_REMOVED) {
listeners[i].ancestorRemoved(ancestorEvent);
} else if (eventID == AncestorEvent.ANCESTOR_MOVED) {
listeners[i].ancestorMoved(ancestorEvent);
}
}
}
示例5: uninstall
import javax.swing.event.AncestorListener; //導入依賴的package包/類
/**
* Uninstalls any existing component updater from component
*/
public static void uninstall ( JComponent component )
{
for ( AncestorListener listener : component.getAncestorListeners () )
{
if ( listener instanceof UpdateTimer )
{
component.removeAncestorListener ( listener );
}
}
}
示例6: isInstalled
import javax.swing.event.AncestorListener; //導入依賴的package包/類
/**
* Checks if component has any component updater installed
*/
public static boolean isInstalled ( JComponent component )
{
for ( AncestorListener listener : component.getAncestorListeners () )
{
if ( listener instanceof UpdateTimer )
{
return true;
}
}
return false;
}
示例7: getAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
public AncestorListener getAncestorListener() {
return ancestorListener;
}
示例8: addAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
/** Overridden to do nothing for performance reasons */
public @Override void addAncestorListener(AncestorListener l) {
if (swingRendering) {
super.addAncestorListener(l);
}
}
示例9: addAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
void addAncestorListener(AncestorListener l) {
}
示例10: removeAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
void removeAncestorListener(AncestorListener l) {
}
示例11: getAncestorListeners
import javax.swing.event.AncestorListener; //導入依賴的package包/類
AncestorListener[] getAncestorListeners() {
return null;
}
示例12: addAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
public void addAncestorListener(final AncestorListener listener) {
if(listener == null){
return;
}
list.add(AncestorListener.class, listener);
}
示例13: removeAncestorListener
import javax.swing.event.AncestorListener; //導入依賴的package包/類
public void removeAncestorListener(final AncestorListener listener) {
if(listener == null){
return;
}
list.remove(AncestorListener.class, listener);
}
示例14: getAncestorListeners
import javax.swing.event.AncestorListener; //導入依賴的package包/類
public AncestorListener[] getAncestorListeners() {
return list.getListeners(AncestorListener.class);
}
示例15: getAncestorListeners
import javax.swing.event.AncestorListener; //導入依賴的package包/類
@Override
public AncestorListener[] getAncestorListeners() {
return JBroTableHeader.this.getAncestorListeners();
}