当前位置: 首页>>代码示例>>Java>>正文


Java Component.addComponentListener方法代码示例

本文整理汇总了Java中java.awt.Component.addComponentListener方法的典型用法代码示例。如果您正苦于以下问题:Java Component.addComponentListener方法的具体用法?Java Component.addComponentListener怎么用?Java Component.addComponentListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Component的用法示例。


在下文中一共展示了Component.addComponentListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addListeners

import java.awt.Component; //导入方法依赖的package包/类
void addListeners(Component ancestor, boolean addToFirst) {
    Component a;

    firstInvisibleAncestor = null;
    for (a = ancestor;
         firstInvisibleAncestor == null;
         a = a.getParent()) {
        if (addToFirst || a != ancestor) {
            a.addComponentListener(this);

            if (a instanceof JComponent) {
                JComponent jAncestor = (JComponent)a;

                jAncestor.addPropertyChangeListener(this);
            }
        }
        if (!a.isVisible() || a.getParent() == null || a instanceof Window) {
            firstInvisibleAncestor = a;
        }
    }
    if (firstInvisibleAncestor instanceof Window &&
        firstInvisibleAncestor.isVisible()) {
        firstInvisibleAncestor = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:AncestorNotifier.java

示例2: setComponent

import java.awt.Component; //导入方法依赖的package包/类
/**
 * Sets the component to be shown.
 * @param component the component to be shown.
 * @param parent the container to which the shown component should be added.
 *               This parameter can be null if you add the component yourself.
 */
public void setComponent(Component component) {
    this.component = component;
    if (null != component) {
        component.addComponentListener(new ComponentAdapter() {

            @Override
            public void componentHidden(ComponentEvent e) {
                if (null != unselectButton && isSelected()) {
                    unselectButton.setSelected(true);
                }
            }
            
        });
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:22,代码来源:ComponentShowingButton.java

示例3: addMoveListener

import java.awt.Component; //导入方法依赖的package包/类
/**
 * Adds a component move listener
 * 
 * @param component
 * @param listener 
 */
public static void addMoveListener(Component component, ComponentMoveListener listener) {
    component.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentMoved(ComponentEvent e) {
            listener.componentMoved(e);
        }
    });
}
 
开发者ID:VISNode,项目名称:VISNode,代码行数:15,代码来源:EventHelper.java

示例4: registerListeners

import java.awt.Component; //导入方法依赖的package包/类
private void registerListeners(Component component) {
    if (splitPaneComponentListener != null) {
        component.addComponentListener(splitPaneComponentListener);
    }

    if (splitPaneActionListener != null) {
        if (component instanceof JTitledPanel) {
            ((JTitledPanel) component).addActionListener(splitPaneActionListener);
        }

        //else if (component instanceof JExtendedSplitPane) ((JTitledPanel)component).addActionListener(splitPaneActionListener);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:JExtendedSplitPane.java

示例5: subscribeActual

import java.awt.Component; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super ComponentEvent> observer) {
    Component w = widget;

    ComponentEventConsumer aec = new ComponentEventConsumer(observer, w);
    observer.onSubscribe(aec);

    w.addComponentListener(aec);
    if (aec.get() == null) {
        aec.onDispose(w);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:13,代码来源:ComponentEventObservable.java


注:本文中的java.awt.Component.addComponentListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。