Numeric spinner

The numeric spinner scrolls through a list of integers within a bounded range. The current selected value is displayed in a text field. You can also enter an integer value as the current value.

Properties

Property Description Data Type Flags* Default Value Valid Value
model The data model used in the Numeric Spinner. com.sun.java.swing.BoundedRangeModel R, W, B, E a new instance of com.sun.java.swing.
DefaultBoundedRangeModel
(0,0,0,100)
any instance of BoundedRangeModel
increment The step value by which the value is changed every time. int R, W, B 1 increment>0
value The current value. int R, W, B 0 maximum>=value>=minimum
minimum The minimum value. int R, W, B 0 minimum<=maximum
maximum The maximum value. int R, W, B 100 maximum>=minimum

* R = read, W = write, B = bound, E = expert

User interface

The currently selected value is displayed in an input field. The following picture shows what this may look like:

Numeric spinner

You can change the numeric value by clicking on different subfields within the input field and using the arrow buttons to spin them. You can also set the values by typing a number into the input field. If the input is invalid, the NumericSpinner restores the previous value after you press the "Enter" or "Tab" key or when you change the focus to another component.