    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class java.util.Observable

    java.lang.Object
       |
       +----java.util.Observable

public class Observable
extends Object

This class should be subclassed by observable object, 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.

##

Observable()
  Construct an Observable with zero Observers

##

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()

  Construct an Observable with zero Observers

##

addObserver

      public synchronized void addObserver(Observer o)

  Adds an observer to the observer list. If the Observer has previously been added, it will not be added again.

  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 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  Class Hierarchy  This Package  Previous  Next  Index