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