Module java.desktop
Package javax.swing

Class SpinnerListModel

java.lang.Object
javax.swing.AbstractSpinnerModel
javax.swing.SpinnerListModel
All Implemented Interfaces:
Serializable, SpinnerModel

public class SpinnerListModel extends AbstractSpinnerModel implements Serializable
A simple implementation of SpinnerModel whose values are defined by an array or a List. For example to create a model defined by an array of the names of the days of the week:
 String[] days = new DateFormatSymbols().getWeekdays();
 SpinnerModel model = new SpinnerListModel(Arrays.asList(days).subList(1, 8));
 
This class only stores a reference to the array or List so if an element of the underlying sequence changes, it's up to the application to notify the ChangeListeners by calling fireStateChanged.

This model inherits a ChangeListener. The ChangeListeners are notified whenever the model's value or list properties changes.

Since:
1.4
See Also: