本文整理汇总了Java中java.awt.Component.addPropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Component.addPropertyChangeListener方法的具体用法?Java Component.addPropertyChangeListener怎么用?Java Component.addPropertyChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.addPropertyChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subscribeActual
import java.awt.Component; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super PropertyChangeEvent> observer) {
Component w = widget;
String pn = propertyName;
PropertyChangeEventConsumer aec = new PropertyChangeEventConsumer(observer, w, pn);
observer.onSubscribe(aec);
if (pn == null) {
w.addPropertyChangeListener(aec);
} else {
w.addPropertyChangeListener(pn, aec);
}
if (aec.get() == null) {
aec.onDispose(w);
}
}
示例2: attachTo
import java.awt.Component; //导入方法依赖的package包/类
protected void attachTo(Component jc) {
if (extListener != null && extListener.accept (jc)) {
extListener.startListeningTo(jc, extNotifier);
listenedTo.add (jc);
if (wizardPage.getMapKeyFor(jc) != null) {
wizardPage.maybeUpdateMap(jc);
}
return;
}
//XXX do mapping model -> component?
if (isProbablyAContainer(jc)) {
attachToHierarchyOf((Container) jc);
} else if (jc instanceof JList) {
listenedTo.add(jc);
((JList) jc).addListSelectionListener(this);
} else if (jc instanceof JComboBox) {
((JComboBox) jc).addActionListener(this);
} else if (jc instanceof JTree) {
listenedTo.add(jc);
((JTree) jc).getSelectionModel().addTreeSelectionListener(this);
} else if (jc instanceof JToggleButton) {
((AbstractButton) jc).addItemListener(this);
} else if (jc instanceof JTextComponent) {
listenedTo.add(jc);
((JTextComponent) jc).getDocument().addDocumentListener(this);
} else if (jc instanceof JColorChooser) {
listenedTo.add(jc);
((JColorChooser) jc).getSelectionModel().addChangeListener(this);
} else if (jc instanceof JSpinner) {
((JSpinner) jc).addChangeListener(this);
} else if (jc instanceof JSlider) {
((JSlider) jc).addChangeListener(this);
} else if (jc instanceof JTable) {
listenedTo.add(jc);
((JTable) jc).getSelectionModel().addListSelectionListener(this);
} else {
//XXX
if (logger.isLoggable(Level.FINE)) {
logger.fine("Don't know how to listen to a " + // NOI18N
jc.getClass().getName());
}
}
if (accept(jc) && !(jc instanceof JPanel)) {
jc.addPropertyChangeListener("name", this);
if (wizardPage.getMapKeyFor(jc) != null) {
wizardPage.maybeUpdateMap(jc);
}
}
if (logger.isLoggable(Level.FINE) && accept(jc)) {
logger.fine("Begin listening to " + jc); // NOI18N
}
}