public final class SwingPropertyChangeSupport extends PropertyChangeSupport
java.beans.PropertyChangeSupport这个子类功能几乎相同。
唯一的区别是如果使用SwingPropertyChangeSupport(sourceBean, true)它确保只有在事件分派线程上通知侦听器 。
| Constructor and Description |
|---|
SwingPropertyChangeSupport(Object sourceBean)
构造一个SwingPropertyChangeSupport对象。
|
SwingPropertyChangeSupport(Object sourceBean, boolean notifyOnEDT)
构造一个SwingPropertyChangeSupport对象。
|
| Modifier and Type | Method and Description |
|---|---|
void |
firePropertyChange(PropertyChangeEvent evt)
将属性更改事件触发到已注册的跟踪器,以跟踪所有属性的更新或具有指定名称的属性。
|
boolean |
isNotifyOnEDT()
返回
notifyOnEDT属性。
|
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListenerpublic SwingPropertyChangeSupport(Object sourceBean)
sourceBean - 要作为任何事件来源的bean。
NullPointerException - 如果
sourceBean是
null
public SwingPropertyChangeSupport(Object sourceBean, boolean notifyOnEDT)
sourceBean - 要作为任何事件来源的bean
notifyOnEDT - 是否仅在
事件调度线程上通知侦听
器
NullPointerException - 如果
sourceBean是
null
public void firePropertyChange(PropertyChangeEvent evt)
如果给定事件的旧值和新值相等且非空值,则不会触发事件。
如果isNotifyOnEDT()是true并调出了事件调度线程,这个实现使用SwingUtilities.invokeLater发送事件分派线程上的通知。 这样可以确保监听者只能在事件发送线程中被通知。
firePropertyChange在
PropertyChangeSupport
evt - 要解雇的
PropertyChangeEvent
NullPointerException - 如果
evt是
null
public final boolean isNotifyOnEDT()
notifyOnEDT属性。
notifyOnEDT属性
SwingPropertyChangeSupport(Object sourceBean, boolean notifyOnEDT)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.