javax.swing

Class AbstractSpinnerModel

public abstract class AbstractSpinnerModel extends Object implements SpinnerModel

Provides standard implementations for some of the methods in {@link SpinnerModel}.

Since: 1.4

Field Summary
protected EventListenerListlistenerList
Stores the listeners registered with the model.
Constructor Summary
AbstractSpinnerModel()
Creates an AbstractSpinnerModel.
Method Summary
voidaddChangeListener(ChangeListener listener)
Registers a ChangeListener with the model so that it will receive {@link ChangeEvent} notifications when the model changes.
protected voidfireStateChanged()
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.
voidremoveChangeListener(ChangeListener listener)
Remove a particular listener.

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 {@link ChangeEvent} notifications when the model changes.

Parameters: listener the listener to add (null is ignored).

fireStateChanged

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

getChangeListeners

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

Returns: all the ChangeListeners

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

removeChangeListener

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

Parameters: listener the listener to remove