JSpinner Class
Package: javax.swing
Using this creates a spinner control, which is a text field that has two little arrows next to it that allow the user to increase or decrease the value in the text field. Usually, the text field contains a number, so clicking one of the little arrows increments or decrements the number. You can also create a spinner that displays data taken from an array or a collection.
Figure 5-11 shows three spinners arranged as a simple time picker.

Figure 5-11
This class can be used in conjunction with the SpinnerModel interface and two classes that implement it: Spinner NumberModel and SpinnerListModel. For more information, see SpinnerNumberModel Class and SpinnerListModel Class.
Constructors
|
Constructor |
Description |
|
|
Creates a default spinner. The default spinner lets the user choose an integer that has an initial value of |
|
|
Creates a spinner using the specified |
Methods
|
Method |
Description |
|
|
Adds a |
|
|
Gets the value |
|
|
Sets the tooltip text that’s displayed if the user rests the mouse over the slider for a few moments |
You can create a default spinner that lets the user select integer ...
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