SpinnerNumberModel 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 range of numbers.
Constructors
|
Constructor |
Description |
|
|
Creates a number spinner model that lets the user select integer values ranging from |
|
|
Creates a number spinner model that lets the user select double values ranging from |
The first, SpinnerNumberModel, creates numeric spinner controls that let you control the initial value, the minimum and maximum values, and the step value that’s added or subtracted each time the user clicks one of the arrows.
Here’s how you can use the SpinnerNumberModel to create a spinner that accepts integers from 1 to 12, starting with 1:
JSpinner hours = new JSpinner(
new SpinnerNumberModel(1, 1, 12, 1));
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