Home

PropertyChangeEvent

PropertyChangeEvent is an event class in the JavaBeans framework used to signal that a bound property on a bean has changed. It is commonly used to notify interested listeners when a property value is updated, enabling data binding and UI updates.

The class is defined in the java.beans package and extends java.util.EventObject, implementing Serializable. A PropertyChangeEvent carries

Usage typically involves a bean that supports property change listeners through a PropertyChangeSupport object. When a

Notes: oldValue and newValue are of type Object and may be null. A bean is free to

See also: PropertyChangeListener, PropertyChangeSupport, and related vetoable change mechanisms.

information
about
the
change:
the
source
object
that
fired
the
event,
the
name
of
the
property
that
changed,
and
the
old
and
new
values.
The
typical
constructor
is
PropertyChangeEvent(Object
source,
String
propertyName,
Object
oldValue,
Object
newValue).
Accessors
include
getPropertyName(),
getOldValue(),
and
getNewValue();
the
getSource()
method
is
inherited
from
EventObject.
property's
value
changes,
the
bean
fires
a
PropertyChangeEvent
to
registered
listeners
by
calling
firePropertyChange
with
the
property
name
and
the
old
and
new
values.
Listeners
implement
PropertyChangeListener
and
respond
in
their
propertyChange(PropertyChangeEvent
evt)
method,
which
can
inspect
the
property
name
and
the
change
details
to
take
appropriate
action.
fire
an
event
only
when
the
change
is
meaningful,
and
some
properties
may
trigger
many
changes
while
others
may
remain
stable.
PropertyChangeEvent
plays
a
central
role
in
JavaBeans
data
binding
and
in
GUI
frameworks
that
reflect
model
changes
in
views.