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 ...
Get Java For Dummies Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.