Using Bound Properties
The class with the bound property creates an instance of the PropertyChangeSupport class:PropertyChangeSupport pcs = new PropertyChangeSupport(this);and uses its add and remove listener methods.
Then the class with the bound property must call firePropertyChange whenever it changes the value of the bound property (i.e. in the set method of the property).
Any class which wants to be notified of changes to the bound property must implement the PropertyChangeListener and supply a method propertyChange that will be called with a PropertyChangeEvent. This method can use event methods getOldValue() and getNewValue.
- The Beanbox will implement this last part for you.