A class should implement the Observer
interface if it is to be notified whenever
an Observable
object has been changed. See the Observable
class (§21.7) for a
discussion of how Observer
objects are notified.
public interfaceObserver
{ public voidupdate
(Observable o, Object arg); }
21.8.1 public void update(Observable o, Object arg)
When an Observable
object has been changed and its notifyObservers
method (§21.7.6) is called, every Observer
object in its set of observers
is notified by invoking its update
method, passing it two arguments: the Observable
object and another argument specified by the call to the notifyObservers
method.