Java Reference
In-Depth Information
public boolean
hasChanged()
Returns the current value of the "changed" flag.
When a change occurs, the
Observable
object should invoke its
setChanged
method and then notify its observers with one of the following methods:
public void
notifyObservers(Object arg)
Notifies all
Observer
objects in the list that something has
happened, and then clears the "changed" flag. For each ob-
server in the list, its
update
method is invoked with this
Observ-
able
object as the first argument and
arg
as the second.
public void
notifyObservers()
Equivalent to
notifyObservers(null)
.
The following
Observable
methods maintain the list of
Observer
objects:
public void
addObserver(Observer o)
Adds the observer
o
to the observer list if it's not already
there.
public void
deleteObserver(Observer o)
Deletes the observer
o
from the observer list.
public void
deleteObservers()
Deletes all
Observer
objects from the observer list.
public int
countObservers()
Returns the number of observers in the observer list.