Class java.util.Observable
All Packages This Package Previous Next
Class java.util.Observable
java.lang.Object
|
+----java.util.Observable
-
public class
Observable
-
extends Object
This class should be subclassed by observable objetc, or "data"
in the Model-View paradigm. An Observable object may have any
number of Observers. Whenever the Observable instance changes, it
notifies all of its observers. Notification is done by calling
the update() method on all observers.
-
Version:
-
1.12, 08/18/95
-
Author:
-
Chris Warth
-
Observable()
-
-
addObserver(Observer)
-
Adds an observer to the observer list.
-
clearChanged()
-
Clears an observable change.
-
countObservers()
-
Counts the number of observers.
-
deleteObserver(Observer)
-
Deletes an observer from the observer list.
-
deleteObservers()
-
Deletes observers from the observer list.
-
hasChanged()
-
Returns a true boolean if an observable change has occurred.
-
notifyObservers()
-
Notifies all observers if an observable change occurs.
-
notifyObservers(Object)
-
Notifies all observers of the specified observable change
which occurred.
-
setChanged()
-
Sets a flag to note an observable change.
Observable
public Observable()
addObserver
public synchronized void addObserver(Observer o)
-
Adds an observer to the observer list.
-
Parameters:
-
o
-
the observer to be added
deleteObserver
public synchronized void deleteObserver(Observer o)
-
Deletes an observer from the observer list.
-
Parameters:
-
o
-
the observer to be deleted
notifyObservers
public void notifyObservers()
-
Notifies all observers if an observable change occurs.
notifyObservers
public synchronized void notifyObservers(Object arg)
-
Notifies all observers of the specified observable change
which occurred.
-
Parameters:
-
arg
-
what is being notified
deleteObservers
public synchronized void deleteObservers()
-
Deletes observers from the observer list.
setChanged
protected synchronized void setChanged()
-
Sets a flag to note an observable change.
clearChanged
protected synchronized void clearChanged()
-
Clears an observable change.
hasChanged
public synchronized boolean hasChanged()
-
Returns a true boolean if an observable change has occurred.
countObservers
public synchronized int countObservers()
-
Counts the number of observers.
All Packages This Package Previous Next