SpinnerListModel Class
Package: javax.swing
Using this provides an implementation of the SpinnerModel
interface from which you create JSpinner
controls that let the user select from a list of items.
Constructors
Constructor |
Description |
|
Creates a list spinner model using the values from the specified array. |
|
Creates a list spinner model using the values from the specified collection. The collection must implement the |
To create a JSpinner control that uses the SpinnerListModel
class, pass an array or a collection to the SpinnerListModel
constructor. For example:
String[] ampmString = {“am”, “pm”};
ampm = new JSpinner(
new SpinnerListModel(ampmString));
In this example, the spinner lets the user select choices from an array of strings that contains two items.