本文整理汇总了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();
}