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.

public class JSpinner extends JComponent implements Accessible

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

Flash Soon


Java JSpinner Example with ChangeListener

Flash Soon



© Sapster 2017