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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access