java.util.Observer
None
None
None
JDK 1.0 or later
The Observer interface is used to implement the view portion of the model-view paradigm. The idea is that an Observable object, the model, represents some data that is being manipulated through a user interface, while Observer objects provide the user with a view of the data. When the Observable object is modified, it tells the Observer objects that the model has been modified by calling notifyObservers(). An Observer object registers with an Observable object to receive notifications when the Observable is modified. The Observer object is then notified of changes via the update() method.
public abstract interface java.util.Observer { // Methods public abstract void update(Observable o, Object arg); }
The object that has been changed.
A "hint" object that describes the change.
This method is called to indicate that the data in the model implemented by the specified Observable object has been modified. The arg parameter is used to communicate changed information from the model to its view.
This "hint" object can be used to efficiently update the views of a model. For example, an Observable object could represent satellite image data. A set of Observer objects would provide different graphical views of the data. If the model data changed, the arg object would describe the part of the data that changed, and the Observer views could use this "hint" to update only parts of their displays.
Observable
This HTML Help has been published using the chm2web software. |