javax.swing
Class AbstractSpinnerModel

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

public abstract class AbstractSpinnerModel
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements SpinnerModel sample code for javax.swing.SpinnerModel definition code for javax.swing.SpinnerModel

This class provides the ChangeListener part of the SpinnerModel interface that should be suitable for most concrete SpinnerModel implementations. Subclasses must provide an implementation of the minimum, maximum, and value properties and the getNextValue and getPreviousValue methods.

Since:
1.4
See Also:
JSpinner sample code for javax.swing.JSpinner definition code for javax.swing.JSpinner , SpinnerModel sample code for javax.swing.SpinnerModel definition code for javax.swing.SpinnerModel , SpinnerListModel sample code for javax.swing.SpinnerListModel definition code for javax.swing.SpinnerListModel , SpinnerNumberModel sample code for javax.swing.SpinnerNumberModel definition code for javax.swing.SpinnerNumberModel , SpinnerDateModel sample code for javax.swing.SpinnerDateModel definition code for javax.swing.SpinnerDateModel

Field Summary
protected  EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList listenerList sample code for javax.swing.AbstractSpinnerModel.listenerList definition code for javax.swing.AbstractSpinnerModel.listenerList
          The list of ChangeListeners for this model.
 
Constructor Summary
AbstractSpinnerModel sample code for javax.swing.AbstractSpinnerModel.AbstractSpinnerModel() definition code for javax.swing.AbstractSpinnerModel.AbstractSpinnerModel() ()
           
 
Method Summary
 void addChangeListener sample code for javax.swing.AbstractSpinnerModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractSpinnerModel.addChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Adds a ChangeListener to the model's listener list.
protected  void fireStateChanged sample code for javax.swing.AbstractSpinnerModel.fireStateChanged() definition code for javax.swing.AbstractSpinnerModel.fireStateChanged() ()
          Run each ChangeListeners stateChanged() method.
 ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners sample code for javax.swing.AbstractSpinnerModel.getChangeListeners() definition code for javax.swing.AbstractSpinnerModel.getChangeListeners() ()
          Returns an array of all the ChangeListeners added to this AbstractSpinnerModel with addChangeListener().
<T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener >
T[]
getListeners sample code for javax.swing.AbstractSpinnerModel.getListeners(java.lang.Class) definition code for javax.swing.AbstractSpinnerModel.getListeners(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
          Return an array of all the listeners of the given type that were added to this model.
 void removeChangeListener sample code for javax.swing.AbstractSpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractSpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Removes a ChangeListener from the model's listener list.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 
Methods inherited from interface javax.swing.SpinnerModel sample code for javax.swing.SpinnerModel definition code for javax.swing.SpinnerModel
getNextValue sample code for javax.swing.SpinnerModel.getNextValue() definition code for javax.swing.SpinnerModel.getNextValue() , getPreviousValue sample code for javax.swing.SpinnerModel.getPreviousValue() definition code for javax.swing.SpinnerModel.getPreviousValue() , getValue sample code for javax.swing.SpinnerModel.getValue() definition code for javax.swing.SpinnerModel.getValue() , setValue sample code for javax.swing.SpinnerModel.setValue(java.lang.Object) definition code for javax.swing.SpinnerModel.setValue(java.lang.Object)
 

Field Detail

listenerList sample code for javax.swing.AbstractSpinnerModel.listenerList

protected EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList  listenerList
The list of ChangeListeners for this model. Subclasses may store their own listeners here.

Constructor Detail

AbstractSpinnerModel sample code for javax.swing.AbstractSpinnerModel() definition code for javax.swing.AbstractSpinnerModel()

public AbstractSpinnerModel()
Method Detail

addChangeListener sample code for javax.swing.AbstractSpinnerModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractSpinnerModel.addChangeListener(javax.swing.event.ChangeListener)

public void addChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Adds a ChangeListener to the model's listener list. The ChangeListeners must be notified when the models value changes.

Specified by:
addChangeListener sample code for javax.swing.SpinnerModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.SpinnerModel.addChangeListener(javax.swing.event.ChangeListener) in interface SpinnerModel sample code for javax.swing.SpinnerModel definition code for javax.swing.SpinnerModel
Parameters:
l - the ChangeListener to add
See Also:
removeChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.AbstractSpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractSpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) , SpinnerModel.addChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.SpinnerModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.SpinnerModel.addChangeListener(javax.swing.event.ChangeListener)

removeChangeListener sample code for javax.swing.AbstractSpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractSpinnerModel.removeChangeListener(javax.swing.event.ChangeListener)

public void removeChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Removes a ChangeListener from the model's listener list.

Specified by:
removeChangeListener sample code for javax.swing.SpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.SpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) in interface SpinnerModel sample code for javax.swing.SpinnerModel definition code for javax.swing.SpinnerModel
Parameters:
l - the ChangeListener to remove
See Also:
addChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.AbstractSpinnerModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.AbstractSpinnerModel.addChangeListener(javax.swing.event.ChangeListener) , SpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.SpinnerModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.SpinnerModel.removeChangeListener(javax.swing.event.ChangeListener)

getChangeListeners sample code for javax.swing.AbstractSpinnerModel.getChangeListeners() definition code for javax.swing.AbstractSpinnerModel.getChangeListeners()

public ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners()
Returns an array of all the ChangeListeners added to this AbstractSpinnerModel with addChangeListener().

Returns:
all of the ChangeListeners added or an empty array if no listeners have been added
Since:
1.4

fireStateChanged sample code for javax.swing.AbstractSpinnerModel.fireStateChanged() definition code for javax.swing.AbstractSpinnerModel.fireStateChanged()

protected void fireStateChanged()
Run each ChangeListeners stateChanged() method.

See Also:
SpinnerModel.setValue(java.lang.Object) sample code for javax.swing.SpinnerModel.setValue(java.lang.Object) definition code for javax.swing.SpinnerModel.setValue(java.lang.Object) , EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

getListeners sample code for javax.swing.AbstractSpinnerModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>) definition code for javax.swing.AbstractSpinnerModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>)

public <T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener > T[] getListeners(Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
Return an array of all the listeners of the given type that were added to this model. For example to find all of the ChangeListeners added to this model:
 myAbstractSpinnerModel.getListeners(ChangeListener.class);
 

Parameters:
listenerType - the type of listeners to return, e.g. ChangeListener.class
Returns:
all of the objects receiving listenerType notifications from this model