from Java Sun's JavaBeans tutorial:

"The accessor methods for a bound property are defined in the same way as those for simple properties. However, you also need to provide the event listener registration methods forPropertyChangeListener classes and fire a PropertyChangeEvent (in the API reference documentation) event to the PropertyChangeListener objects by calling their propertyChange methods"

Can someone provide a short example of this? I'm not sure I totally understand the whole paragraph but I can't pinpoint what exactly I'm not getting.

If you read further down and walk through their example, it becomes a little more clear what they mean and they demonstrate using the PropertyChangeSupport class as a helper. Basically, your methods that alter the bound properties need to also fire change events so that change listeners get notified, ie they have to announce "Hey, I changed this"

pcs.firePropertyChange( "title", old, title );

Your bean class also has to provide the methods to add/remove property change listeners

public void addPropertyChangeListener( PropertyChangeListener listener )
{...

as they show in their little demo class. The methods they show there just forward the listener reference along to the PropertyChangeSupport object that is managing all that for you.

There is a more detailed, step-by-step walkthrough of implementing this here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.