java.lang.Object | +----java.util.Observable
This class represents an observable object, or "data" in the model-view paradigm. It can be subclassed to represent an object that the application wants to have observed.
An observable object can have one or more observers. After an
observable instance changes, an application calling the
Observable
's notifyObservers
method
causes all of its observers to be notified of the change by a call
to their update
method.
hasChanged
method, then notify all of its observers
and then call the clearChanged
method to
indicate that this object has no longer changed.
hasChanged
method, then notify all of its observers
and then call the clearChanged
method to indicate
that this object has no longer changed.
public Observable()
public synchronized void addObserver(Observer o)
public synchronized void deleteObserver(Observer o)
public void notifyObservers()
hasChanged
method, then notify all of its observers
and then call the clearChanged
method to
indicate that this object has no longer changed.
Each observer has its update
method called with two
arguments: this observable object and null
.
public void notifyObservers(Object arg)
hasChanged
method, then notify all of its observers
and then call the clearChanged
method to indicate
that this object has no longer changed.
Each observer has its update
method called with two
arguments: this observable object and the arg
argument.
public synchronized void deleteObservers()
protected synchronized void setChanged()
protected synchronized void clearChanged()
notifyObservers
methods.
public synchronized boolean hasChanged()
true
if the setChanged
method
has been called more recently than the clearChanged
method on this object; false
otherwise.
public synchronized int countObservers()