Javatpoint Logo
Javatpoint Logo

Java JSpinner

The object of JSpinner class is a single line input field that allows the user to select a number or an object value from an ordered sequence.


JSpinner class declaration

Let's see the declaration for javax.swing.JSpinner class.

Commonly used Contructors:

Constructor Description
JSpinner() It is used to construct a spinner with an Integer SpinnerNumberModel with initial value 0 and no minimum or maximum limits.
JSpinner(SpinnerModel model) It is used to construct a spinner for a given model.

Commonly used Methods:

Method Description
void addChangeListener(ChangeListener listener) It is used to add a listener to the list that is notified each time a change to the model occurs.
Object getValue() It is used to return the current value of the model.

Java JSpinner Example

Output:

Java Jspiner 1

Java JSpinner Example with ChangeListener

imp

Output:

Java Jspiner 2
Next TopicJava JDialog





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA