javax.swing
Class AbstractSpinnerModel

java.lang.Object
  extended by javax.swing.AbstractSpinnerModel
All Implemented Interfaces:
SpinnerModel
Direct Known Subclasses:
SpinnerDateModel, SpinnerListModel, SpinnerNumberModel

public abstract class AbstractSpinnerModel
extends Object
implements SpinnerModel

Provides standard implementations for some of the methods in SpinnerModel.

Since:
1.4

Field Summary
protected  EventListenerList listenerList
          Stores the listeners registered with the model.
 
Constructor Summary
AbstractSpinnerModel()
          Creates an AbstractSpinnerModel.
 
Method Summary
 void addChangeListener(ChangeListener listener)
          Registers a ChangeListener with the model so that it will receive ChangeEvent notifications when the model changes.
protected  void fireStateChanged()
          Fires a ChangeEvent to all the ChangeListeners added to this model
 ChangeListener[] getChangeListeners()
          Gets all the ChangeListeners.
<T extends EventListener>
T[]
getListeners(Class<T> c)
          Gets all the listeners that are of a particular type.
 void removeChangeListener(ChangeListener listener)
          Remove a particular listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.SpinnerModel
getNextValue, getPreviousValue, getValue, setValue
 

Field Detail

listenerList

protected EventListenerList listenerList
Stores the listeners registered with the model.

Constructor Detail

AbstractSpinnerModel

public AbstractSpinnerModel()
Creates an AbstractSpinnerModel.

Method Detail

addChangeListener

public void addChangeListener(ChangeListener listener)
Registers a ChangeListener with the model so that it will receive ChangeEvent notifications when the model changes.

Specified by:
addChangeListener in interface SpinnerModel
Parameters:
listener - the listener to add (null is ignored).

getListeners

public <T extends EventListener> T[] getListeners(Class<T> c)
Gets all the listeners that are of a particular type.

Parameters:
c - the type of listener
Returns:
the listeners that are of the specific type

getChangeListeners

public ChangeListener[] getChangeListeners()
Gets all the ChangeListeners.

Returns:
all the ChangeListeners

removeChangeListener

public void removeChangeListener(ChangeListener listener)
Remove a particular listener.

Specified by:
removeChangeListener in interface SpinnerModel
Parameters:
listener - the listener to remove

fireStateChanged

protected void fireStateChanged()
Fires a ChangeEvent to all the ChangeListeners added to this model