public abstract class

AbstractSpinnerModel

extends Object
implements SpinnerModel
java.lang.Object
   ↳ javax.swing.AbstractSpinnerModel
Known Direct Subclasses

Class Overview

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 setValue, getValue, getNextValue and getPreviousValue methods.

Summary

Fields
protected EventListenerList listenerList The list of ChangeListeners for this model.
Public Constructors
AbstractSpinnerModel()
Public Methods
void addChangeListener(ChangeListener l)
Adds a ChangeListener to the model's listener list.
ChangeListener[] getChangeListeners()
Returns an array of all the ChangeListeners added to this AbstractSpinnerModel with addChangeListener().
<T extends EventListener> T[] getListeners(Class<T> listenerType)
Return an array of all the listeners of the given type that were added to this model.
void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the model's listener list.
Protected Methods
void fireStateChanged()
Run each ChangeListeners stateChanged() method.
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.swing.SpinnerModel

Fields

protected EventListenerList listenerList

The list of ChangeListeners for this model. Subclasses may store their own listeners here.

Public Constructors

public AbstractSpinnerModel ()

Public Methods

public void addChangeListener (ChangeListener l)

Adds a ChangeListener to the model's listener list. The ChangeListeners must be notified when the models value changes.

Parameters
l the ChangeListener to add

public 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

public T[] getListeners (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

public void removeChangeListener (ChangeListener l)

Removes a ChangeListener from the model's listener list.

Parameters
l the ChangeListener to remove

Protected Methods

protected void fireStateChanged ()

Run each ChangeListeners stateChanged() method.