Observer Observable

see also JavaIdioms
ObserverObservable is Java's implementation of the ObserverPattern from the GangOfFour book, DesignPatterns. Observable is a class that implements the GoF's "subject" methods (i.e. addObserver(), removeObserver(), notifyObservers(). Observer is an interface that defines an "update()" method.

The Java Swing GUI uses the ObserverPattern for communication with the widgets, but does not use Java's own ObserverObservable classes. Observers are called (event) listeners, and Swing relies on a set of method naming conventions (e.g. addListener()), instead of a common implementation.

View edit of January 29, 2005 or FindPage with title or text search