Top Description Fields Constructors Methods
javafx.scene.control

public Class Spinner<T>

extends Control
Class Inheritance
Type Parameters
<T>
The type of all values that can be iterated through in the Spinner. Common types include Integer and String.
Imports
com.sun.javafx.scene.control.FakeFocusTextField, javafx.beans.property.StringProperty, .BooleanProperty, .ObjectProperty, .ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, .SimpleBooleanProperty, .SimpleObjectProperty, javafx.scene.control.skin.SpinnerSkin, javafx.beans.NamedArg, javafx.beans.value.ChangeListener, .ObservableValue, .WritableValue, javafx.collections.MapChangeListener, .ObservableList, javafx.scene.AccessibleAction, .AccessibleAttribute, .AccessibleRole, javafx.util.Duration, .StringConverter, java.math.BigDecimal, java.time.LocalDate, .LocalTime, java.time.temporal.TemporalUnit, javafx.css.CssMetaData, .Styleable, .StyleableProperty, .SimpleStyleableObjectProperty, javafx.css.converter.DurationConverter, java.util.ArrayList, .Collections, .List

A single line text field that lets the user select a number or an object value from an ordered sequence. Spinners typically provide a pair of tiny arrow buttons for stepping through the elements of the sequence. The keyboard up/down arrow keys also cycle through the elements. The user may also be allowed to type a (legal) value directly into the spinner. Although combo boxes provide similar functionality, spinners are sometimes preferred because they don't require a drop down list that can obscure important data, and also because they allow for features such as wrapping and simpler specification of 'infinite' data models (the SpinnerValueFactory, rather than using a ObservableList data model like many other JavaFX UI controls.

A Spinner's sequence value is defined by its SpinnerValueFactory. The value factory can be specified as a constructor argument and changed with the value factory property. SpinnerValueFactory classes for some common types are provided with JavaFX, including:

A Spinner has a TextField child component that is responsible for displaying and potentially changing the current value of the Spinner, which is called the editor. By default the Spinner is non-editable, but input can be accepted if the editable property is set to true. The Spinner editor stays in sync with the value factory by listening for changes to the value property of the value factory. If the user has changed the value displayed in the editor it is possible for the Spinner value to differ from that of the editor. To make sure the model has the same value as the editor, the user must commit the edit using the Enter key.

Example:

Spinner spinner = new Spinner(0, 10, 5);
Image of the Spinner control
Since
JavaFX 8u40
See Also
SpinnerValueFactory

Field Summary

Modifier and TypeField and Description
private final ChangeListener<StringConverter<T>>
private static final String
private BooleanProperty
editable

The editable property is used to specify whether user input is able to be typed into the Spinner editor.

private ReadOnlyObjectWrapper<TextField>
private static final CssMetaData<Spinner<?>, Duration>
private final ObjectProperty<Duration>
private static final CssMetaData<Spinner<?>, Duration>
private final ObjectProperty<Duration>
public static final String
STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTAL

The arrows are placed on the left of the Spinner, pointing horizontally (i.e. left and right).

public static final String
STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL

The arrows are placed on the left of the Spinner, pointing vertically (i.e. up and down).

public static final String
STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTAL

The arrows are placed on the right of the Spinner, pointing horizontally (i.e. left and right).

public static final String
STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL

The decrement arrow is placed on the left of the Spinner, and the increment on the right.

public static final String
STYLE_CLASS_SPLIT_ARROWS_VERTICAL

The arrows are placed above and beneath the spinner, stretching to take the entire width.

private static final List<CssMetaData<? extends Styleable, ?>>
private TextField
private ReadOnlyObjectWrapper<T>
value

The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactory value property.

private ObjectProperty<SpinnerValueFactory<T>>
valueFactory

The value factory is the model behind the JavaFX Spinner control - without a value factory installed a Spinner is unusable.

Constructor Summary

AccessConstructor and Description
public
Spinner()

Constructs a default Spinner instance, with the default 'spinner' style class and a non-editable editor.

public
Spinner(int
The minimum allowed integer value for the Spinner.
min
,
int
The maximum allowed integer value for the Spinner.
max
,
int
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.IntegerSpinnerValueFactory.

public
Spinner(int
The minimum allowed integer value for the Spinner.
min
,
int
The maximum allowed integer value for the Spinner.
max
,
int
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
,
int
The amount to increment or decrement by, per step.
amountToStepBy
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.IntegerSpinnerValueFactory.

public
Spinner(double
The minimum allowed double value for the Spinner.
min
,
double
The maximum allowed double value for the Spinner.
max
,
double
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.DoubleSpinnerValueFactory.

public
Spinner(double
The minimum allowed double value for the Spinner.
min
,
double
The maximum allowed double value for the Spinner.
max
,
double
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
,
double
The amount to increment or decrement by, per step.
amountToStepBy
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.DoubleSpinnerValueFactory.

pack-priv
Spinner(LocalDate
The minimum allowed LocalDate value for the Spinner.
min
,
LocalDate
The maximum allowed LocalDate value for the Spinner.
max
,
LocalDate
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalDateSpinnerValueFactory.

pack-priv
Spinner(LocalDate
The minimum allowed LocalDate value for the Spinner.
min
,
LocalDate
The maximum allowed LocalDate value for the Spinner.
max
,
LocalDate
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
,
long
The amount to increment or decrement by, per step.
amountToStepBy
,
TemporalUnit
The size of each step (e.g. day, week, month, year, etc).
temporalUnit
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalDateSpinnerValueFactory.

pack-priv
Spinner(LocalTime
The minimum allowed LocalTime value for the Spinner.
min
,
LocalTime
The maximum allowed LocalTime value for the Spinner.
max
,
LocalTime
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalTimeSpinnerValueFactory.

pack-priv
Spinner(LocalTime
The minimum allowed LocalTime value for the Spinner.
min
,
LocalTime
The maximum allowed LocalTime value for the Spinner.
max
,
LocalTime
The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.
initialValue
,
long
The amount to increment or decrement by, per step.
amountToStepBy
,
TemporalUnit
The size of each step (e.g. hour, minute, second, etc).
temporalUnit
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalTimeSpinnerValueFactory.

public
Spinner(ObservableList<T>
A list of items that will be stepped through in the Spinner.
items
)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.ListSpinnerValueFactory.

public
Spinner(SpinnerValueFactory<T>
The value factory to use.
valueFactory
)

Creates a Spinner instance with the given value factory set.

Method Summary

Modifier and TypeMethod and Description
public final void
cancelEdit()

If the Spinner is editable, calling this method will attempt to replace the editor text with the last committed value.

public final void
commitValue()

If the Spinner is editable, calling this method will attempt to commit the current text and convert it to a value.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public void
decrement()

Attempts to decrement the value factory by one step, by calling the SpinnerValueFactory#decrement(int) method with an argument of one.

public void
decrement(int
The number of decrements that should be performed on the value.
steps
)

Attempts to decrement the value factory by the given number of steps, by calling the SpinnerValueFactory#decrement(int) method and forwarding the steps argument to it.

public final BooleanProperty
public final ReadOnlyObjectProperty<TextField>

Returns:

the editor property
editorProperty
()

The editor used by the Spinner control.

public void
executeAccessibleAction(AccessibleAction
the action to execute
action
,
Object...
optional list of parameters
parameters
)

Overrides javafx.scene.control.Control.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData
getClassCssMetaData
()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final TextField
public final Duration
public final String
public final Duration
public final T
public final SpinnerValueFactory<T>
public void
increment()

Attempts to increment the value factory by one step, by calling the SpinnerValueFactory#increment(int) method with an argument of one.

public void
increment(int
The number of increments that should be performed on the value.
steps
)

Attempts to increment the value factory by the given number of steps, by calling the SpinnerValueFactory#increment(int) method and forwarding the steps argument to it.

public final ObjectProperty<Duration>

Returns:

initial delay property
initialDelayProperty
()

The duration that the mouse has to be pressed on an arrow button before the next value steps.

public final boolean
public final StringProperty

Returns:

the prompt text property
promptTextProperty
()

The prompt text to display in the Spinner, or null if no prompt text is displayed.

public Object
queryAccessibleAttribute(AccessibleAttribute
the requested attribute
attribute
,
Object...
optional list of parameters
parameters
)

Overrides javafx.scene.control.Control.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

public final ObjectProperty<Duration>

Returns:

repeat delay property
repeatDelayProperty
()

The duration that the mouse has to be pressed for each successive step after the first value steps.

public final void
setEditable(boolean value)

public final void
public final void
public final void
private void
setText(T value)

public final void
public final ObjectProperty<SpinnerValueFactory<T>>
public final ReadOnlyObjectProperty<T>
pack-priv static int
wrapValue(int value, int min, int max)

pack-priv static BigDecimal
wrapValue(BigDecimal currentValue, BigDecimal newValue, BigDecimal min, BigDecimal max)

Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertygetBaselineOffsetgetContextMenugetControlChildrengetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenloadSkinClasssetContextMenusetSkinsetTooltipskinClassNamePropertyskinPropertytooltipProperty

Field Detail

converterListenerback to summary
private final ChangeListener<StringConverter<T>> converterListener
DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS
editableback to summary
private BooleanProperty editable

The editable property is used to specify whether user input is able to be typed into the Spinner editor. If editable is true, user input will be received once the user types and presses the Enter key. At this point the input is passed to the SpinnerValueFactory converter javafx.util.StringConverter#fromString(String) method. The returned value from this call (of type T) is then sent to the SpinnerValueFactory#setValue(Object) method. If the value is valid, it will remain as the value. If it is invalid, the value factory will need to react accordingly and back out this change.

Default Value
false
editorback to summary
private ReadOnlyObjectWrapper<TextField> editor
INITIAL_DELAYback to summary
private static final CssMetaData<Spinner<?>, Duration> INITIAL_DELAY
initialDelayback to summary
private final ObjectProperty<Duration> initialDelay
REPEAT_DELAYback to summary
private static final CssMetaData<Spinner<?>, Duration> REPEAT_DELAY
repeatDelayback to summary
private final ObjectProperty<Duration> repeatDelay
STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTALback to summary
public static final String STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTAL

The arrows are placed on the left of the Spinner, pointing horizontally (i.e. left and right).

STYLE_CLASS_ARROWS_ON_LEFT_VERTICALback to summary
public static final String STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL

The arrows are placed on the left of the Spinner, pointing vertically (i.e. up and down).

STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTALback to summary
public static final String STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTAL

The arrows are placed on the right of the Spinner, pointing horizontally (i.e. left and right).

STYLE_CLASS_SPLIT_ARROWS_HORIZONTALback to summary
public static final String STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL

The decrement arrow is placed on the left of the Spinner, and the increment on the right.

STYLE_CLASS_SPLIT_ARROWS_VERTICALback to summary
public static final String STYLE_CLASS_SPLIT_ARROWS_VERTICAL

The arrows are placed above and beneath the spinner, stretching to take the entire width.

STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES
textFieldback to summary
private TextField textField
valueback to summary
private ReadOnlyObjectWrapper<T> value

The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactory value property. Should the value factory change, this value property will be unbound from the old value factory and bound to the new one.

If developers wish to modify the value property, they may do so with code in the following form:

Object newValue = ...;
spinner.getValueFactory().setValue(newValue);
valueFactoryback to summary
private ObjectProperty<SpinnerValueFactory<T>> valueFactory

The value factory is the model behind the JavaFX Spinner control - without a value factory installed a Spinner is unusable. It is the role of the value factory to handle almost all aspects of the Spinner, including:

Constructor Detail

Spinnerback to summary
public Spinner()

Constructs a default Spinner instance, with the default 'spinner' style class and a non-editable editor.

Spinnerback to summary
public Spinner(int min, int max, int initialValue)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.IntegerSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is Integer, i.e. Spinner<Integer>.

Parameters
min:int

The minimum allowed integer value for the Spinner.

max:int

The maximum allowed integer value for the Spinner.

initialValue:int

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

Spinnerback to summary
public Spinner(int min, int max, int initialValue, int amountToStepBy)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.IntegerSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is Integer, i.e. Spinner<Integer>.

Parameters
min:int

The minimum allowed integer value for the Spinner.

max:int

The maximum allowed integer value for the Spinner.

initialValue:int

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

amountToStepBy:int

The amount to increment or decrement by, per step.

Spinnerback to summary
public Spinner(double min, double max, double initialValue)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.DoubleSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is Double, i.e. Spinner<Double>.

Parameters
min:double

The minimum allowed double value for the Spinner.

max:double

The maximum allowed double value for the Spinner.

initialValue:double

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

Spinnerback to summary
public Spinner(double min, double max, double initialValue, double amountToStepBy)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.DoubleSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is Double, i.e. Spinner<Double>.

Parameters
min:double

The minimum allowed double value for the Spinner.

max:double

The maximum allowed double value for the Spinner.

initialValue:double

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

amountToStepBy:double

The amount to increment or decrement by, per step.

Spinnerback to summary
pack-priv Spinner(LocalDate min, LocalDate max, LocalDate initialValue)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalDateSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is LocalDate, i.e. Spinner<LocalDate>.

Parameters
min:LocalDate

The minimum allowed LocalDate value for the Spinner.

max:LocalDate

The maximum allowed LocalDate value for the Spinner.

initialValue:LocalDate

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

Spinnerback to summary
pack-priv Spinner(LocalDate min, LocalDate max, LocalDate initialValue, long amountToStepBy, TemporalUnit temporalUnit)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalDateSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is LocalDate, i.e. Spinner<LocalDate>.

Parameters
min:LocalDate

The minimum allowed LocalDate value for the Spinner.

max:LocalDate

The maximum allowed LocalDate value for the Spinner.

initialValue:LocalDate

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

amountToStepBy:long

The amount to increment or decrement by, per step.

temporalUnit:TemporalUnit

The size of each step (e.g. day, week, month, year, etc).

Spinnerback to summary
pack-priv Spinner(LocalTime min, LocalTime max, LocalTime initialValue)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalTimeSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is LocalTime, i.e. Spinner<LocalTime>.

Parameters
min:LocalTime

The minimum allowed LocalTime value for the Spinner.

max:LocalTime

The maximum allowed LocalTime value for the Spinner.

initialValue:LocalTime

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

Spinnerback to summary
pack-priv Spinner(LocalTime min, LocalTime max, LocalTime initialValue, long amountToStepBy, TemporalUnit temporalUnit)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.LocalTimeSpinnerValueFactory. Note that if this constructor is called, the only valid generic type for the Spinner instance is LocalTime, i.e. Spinner<LocalTime>.

Parameters
min:LocalTime

The minimum allowed LocalTime value for the Spinner.

max:LocalTime

The maximum allowed LocalTime value for the Spinner.

initialValue:LocalTime

The value of the Spinner when first instantiated, must be within the bounds of the min and max arguments, or else the min value will be used.

amountToStepBy:long

The amount to increment or decrement by, per step.

temporalUnit:TemporalUnit

The size of each step (e.g. hour, minute, second, etc).

Spinnerback to summary
public Spinner(ObservableList<T> items)

Creates a Spinner instance with the value factory set to be an instance of SpinnerValueFactory.ListSpinnerValueFactory. The Spinner value property will be set to the first element of the list, if an element exists, or null otherwise.

Parameters
items:ObservableList<T>

A list of items that will be stepped through in the Spinner.

Spinnerback to summary
public Spinner(SpinnerValueFactory<T> valueFactory)

Creates a Spinner instance with the given value factory set.

Parameters
valueFactory:SpinnerValueFactory<T>

The value factory to use.

Method Detail

cancelEditback to summary
public final void cancelEdit()

If the Spinner is editable, calling this method will attempt to replace the editor text with the last committed value.

Since
9
commitValueback to summary
public final void commitValue()

If the Spinner is editable, calling this method will attempt to commit the current text and convert it to a value.

Since
9
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Returns:Skin<?>

new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.

Annotations
@Override
decrementback to summary
public void decrement()

Attempts to decrement the value factory by one step, by calling the SpinnerValueFactory#decrement(int) method with an argument of one. If the value factory is null, an IllegalStateException is thrown.

Exceptions
IllegalStateException:
if the value factory returned by calling getValueFactory() is null.
decrementback to summary
public void decrement(int steps)

Attempts to decrement the value factory by the given number of steps, by calling the SpinnerValueFactory#decrement(int) method and forwarding the steps argument to it. If the value factory is null, an IllegalStateException is thrown.

Parameters
steps:int

The number of decrements that should be performed on the value.

Exceptions
IllegalStateException:
if the value factory returned by calling getValueFactory() is null.
editablePropertyback to summary
public final BooleanProperty editableProperty()
editorPropertyback to summary
public final ReadOnlyObjectProperty<TextField> editorProperty()

The editor used by the Spinner control.

Returns:ReadOnlyObjectProperty<TextField>

the editor property

executeAccessibleActionback to summary
public void executeAccessibleAction(AccessibleAction action, Object... parameters)

Overrides javafx.scene.control.Control.executeAccessibleAction.

Doc from javafx.scene.control.Control.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

This method is commonly overridden by subclasses to implement action that are required for a specific role.
If a particular action is not handled, the superclass implementation must be called.

Parameters
action:AccessibleAction

Doc from javafx.scene.Node.executeAccessibleAction.

the action to execute

parameters:Object[]

Doc from javafx.scene.Node.executeAccessibleAction.

optional list of parameters

Annotations
@Override
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

Returns:List<CssMetaData<? extends Styleable, ?>>

the CssMetaData

Since
11
getControlCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Returns:List<CssMetaData<? extends Styleable, ?>>

the unmodifiable list of the control's CSS-styleable properties

Annotations
@Override
getEditorback to summary
public final TextField getEditor()
getInitialDelayback to summary
public final Duration getInitialDelay()
getPromptTextback to summary
public final String getPromptText()
getRepeatDelayback to summary
public final Duration getRepeatDelay()
getValueback to summary
public final T getValue()
getValueFactoryback to summary
public final SpinnerValueFactory<T> getValueFactory()
incrementback to summary
public void increment()

Attempts to increment the value factory by one step, by calling the SpinnerValueFactory#increment(int) method with an argument of one. If the value factory is null, an IllegalStateException is thrown.

Exceptions
IllegalStateException:
if the value factory returned by calling getValueFactory() is null.
incrementback to summary
public void increment(int steps)

Attempts to increment the value factory by the given number of steps, by calling the SpinnerValueFactory#increment(int) method and forwarding the steps argument to it. If the value factory is null, an IllegalStateException is thrown.

Parameters
steps:int

The number of increments that should be performed on the value.

Exceptions
IllegalStateException:
if the value factory returned by calling getValueFactory() is null.
initialDelayPropertyback to summary
public final ObjectProperty<Duration> initialDelayProperty()

The duration that the mouse has to be pressed on an arrow button before the next value steps. Successive step duration is set using repeat delay.

Returns:ObjectProperty<Duration>

initial delay property

Default Value
300ms
Since
11
isEditableback to summary
public final boolean isEditable()
promptTextPropertyback to summary
public final StringProperty promptTextProperty()

The prompt text to display in the Spinner, or null if no prompt text is displayed.

Returns:StringProperty

the prompt text property

Default Value
Empty string
Since
9
queryAccessibleAttributeback to summary
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.Control.queryAccessibleAttribute.

Doc from javafx.scene.control.Control.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
If a particular attribute is not handled, the superclass implementation must be called.

Parameters
attribute:AccessibleAttribute

Doc from javafx.scene.Node.queryAccessibleAttribute.

the requested attribute

parameters:Object[]

Doc from javafx.scene.Node.queryAccessibleAttribute.

optional list of parameters

Returns:Object

Doc from javafx.scene.Node.queryAccessibleAttribute.

the value for the requested attribute

Annotations
@Override
repeatDelayPropertyback to summary
public final ObjectProperty<Duration> repeatDelayProperty()

The duration that the mouse has to be pressed for each successive step after the first value steps. Initial step duration is set using initial delay.

Returns:ObjectProperty<Duration>

repeat delay property

Default Value
60ms
Since
11
setEditableback to summary
public final void setEditable(boolean value)
setInitialDelayback to summary
public final void setInitialDelay(Duration value)
setPromptTextback to summary
public final void setPromptText(String value)
setRepeatDelayback to summary
public final void setRepeatDelay(Duration value)
setTextback to summary
private void setText(T value)
setValueFactoryback to summary
public final void setValueFactory(SpinnerValueFactory<T> value)
valueFactoryPropertyback to summary
public final ObjectProperty<SpinnerValueFactory<T>> valueFactoryProperty()
valuePropertyback to summary
public final ReadOnlyObjectProperty<T> valueProperty()
wrapValueback to summary
pack-priv static int wrapValue(int value, int min, int max)
wrapValueback to summary
pack-priv static BigDecimal wrapValue(BigDecimal currentValue, BigDecimal newValue, BigDecimal min, BigDecimal max)