Home

PropertyChangeSupport

PropertyChangeSupport is a utility class in the Java Platform that implements the listener pattern for bound properties. Located in the java.beans package, it provides a convenient way for JavaBeans components to manage PropertyChangeListener objects and to publish PropertyChangeEvents when a bound property changes.

A bean can create a PropertyChangeSupport instance, typically initialized with the bean as the source. It exposes

When a property value is updated, the bean checks for a real change and then invokes the

PropertyChangeSupport is commonly used to implement bound properties in JavaBeans and to decouple property change notification

methods
to
add
and
remove
listeners,
either
globally
or
for
a
specific
property,
and
to
query
current
listeners.
The
primary
mechanism
for
notifying
listeners
is
by
calling
firePropertyChange
with
the
property
name
and
either
the
old
and
new
values,
or
a
PropertyChangeEvent.
Overloaded
firePropertyChange
methods
exist
for
Object
values
as
well
as
primitive
types
such
as
boolean,
int,
long,
float,
and
double.
appropriate
firePropertyChange
variant.
Listeners
registered
for
the
specific
property
receive
the
event;
those
registered
without
a
property
name
receive
all
events.
The
class
is
designed
to
be
thread-safe
for
listener
management
and
makes
a
snapshot
of
listeners
to
minimize
synchronization
during
dispatch.
from
property
logic.
It
is
often
used
in
GUI
applications
and
other
event-driven
components.
See
also:
PropertyChangeListener,
PropertyChangeEvent,
java.beans
package.