Code example for PropertyChangeSupport

Methods: addPropertyChangeListener

0
	transient protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
 
	static final long serialVersionUID = 1;
 
	public void addPropertyChangeListener(PropertyChangeListener l) {
		listeners.addPropertyChangeListener(l);
	} 
 
	protected void firePropertyChange(String prop, Object old, Object newValue) {
		listeners.firePropertyChange(prop, old, newValue);
	} 
 
	protected void fireStructureChange(String prop, Object child) {
		listeners.firePropertyChange(prop, null, child);
	} 
 
	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();
		listeners = new PropertyChangeSupport(this);
	}