Home

PropertyChangeListener

PropertyChangeListener is an interface in the JavaBeans framework that enables one object to listen for changes to bound properties of another bean. Implementations receive notifications when a bound property changes, allowing components to react to state updates in a decoupled way.

The interface defines a single method: propertyChange(PropertyChangeEvent evt). The PropertyChangeEvent object carries information about the change,

Beans that expose bound properties provide methods to manage listeners, typically addPropertyChangeListener and removePropertyChangeListener, with optional

A typical usage pattern involves creating or obtaining a bean that supports bound properties, registering a

PropertyChangeSupport is a utility class in java.beans that simplifies listener management, offering addPropertyChangeListener, removePropertyChangeListener, and firePropertyChange

Notes: PropertyChangeListener is part of the JavaBeans event model. It is distinct from Constrained properties (which

including
the
source
bean,
the
name
of
the
changed
property,
the
old
value,
and
the
new
value.
This
event
is
delivered
to
all
registered
listeners
when
a
bean
fires
a
property
change.
overloads
that
accept
a
specific
property
name.
When
a
bound
property
changes,
the
bean
should
fire
a
PropertyChangeEvent,
commonly
via
a
helper
like
PropertyChangeSupport,
which
handles
listener
management
and
event
dispatch.
PropertyChangeListener,
and
implementing
the
propertyChange
method
to
respond
to
updates.
Conversely,
the
bean’s
setter
methods
update
the
property
value
and
then
invoke
firePropertyChange
to
notify
listeners.
methods.
This
pattern
is
widely
used
in
Java
Swing
models
and
other
JavaBeans-based
architectures
to
enable
GUI
components
and
other
collaborators
to
react
to
state
changes.
use
VetoableChangeListener)
and
is
meant
for
observing
changes
rather
than
enforcing
constraints.