O'Reilly logo

Core Java® Volume II—Advanced Features, Ninth Edition by Gary Cornell, Cay S. Horstmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.5.3. Bound Properties

Bound properties tell interested listeners that their value has changed. For example, the fileName property in FilePickerBean is a bound property. When the file name changes, then ImageViewerBean is automatically notified and loads the new file.

To implement a bound property, you must implement two mechanisms:

1. Whenever the value of the property changes, the bean must send a PropertyChange event to all registered listeners. This change can occur when the set method is called or when some other method (such as the action listener of the “. . .” button) changes the value.

2. To enable interested listeners to register themselves, the bean has to implement the following two methods:

void addPropertyChangeListener(PropertyChangeListener ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required