- Type Parameters:
T
- The type of all values that can be iterated through in the Spinner. Common types include Integer and String.
- All Implemented Interfaces:
Styleable
,EventTarget
,Skinnable
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:
SpinnerValueFactory.IntegerSpinnerValueFactory
SpinnerValueFactory.DoubleSpinnerValueFactory
SpinnerValueFactory.ListSpinnerValueFactory
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);
- Since:
- JavaFX 8u40
- See Also:
-
Property Summary
TypePropertyDescriptionfinal BooleanProperty
The editable property is used to specify whether user input is able to be typed into the Spinnereditor
.final ReadOnlyObjectProperty
<TextField> The editor used by the Spinner control.final ObjectProperty
<Duration> The duration that the mouse has to be pressed on an arrow button before the next value steps.final StringProperty
The prompt text to display in theSpinner
, ornull
if no prompt text is displayed.final ObjectProperty
<Duration> The duration that the mouse has to be pressed for each successive step after the first value steps.final ObjectProperty
<SpinnerValueFactory<T>> The value factory is the model behind the JavaFX Spinner control - without a value factory installed a Spinner is unusable.final ReadOnlyObjectProperty
<T> The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property
.Properties declared in class javafx.scene.control.Control
contextMenu, skin, tooltip
Properties declared in class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
Properties declared in class javafx.scene.Parent
needsLayout
Properties declared in class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The arrows are placed on the left of the Spinner, pointing horizontally (i.e.static final String
The arrows are placed on the left of the Spinner, pointing vertically (i.e.static final String
The arrows are placed on the right of the Spinner, pointing horizontally (i.e.static final String
The decrement arrow is placed on the left of the Spinner, and the increment on the right.static final String
The arrows are placed above and beneath the spinner, stretching to take the entire width.Fields declared in class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
Fields declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Constructor Summary
ConstructorDescriptionSpinner()
Constructs a default Spinner instance, with the default 'spinner' style class and a non-editable editor.Spinner
(double min, double max, double initialValue) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.DoubleSpinnerValueFactory
.Spinner
(double min, double max, double initialValue, double amountToStepBy) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.DoubleSpinnerValueFactory
.Spinner
(int min, int max, int initialValue) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.IntegerSpinnerValueFactory
.Spinner
(int min, int max, int initialValue, int amountToStepBy) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.IntegerSpinnerValueFactory
.Spinner
(ObservableList<T> items) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.ListSpinnerValueFactory
.Spinner
(SpinnerValueFactory<T> valueFactory) Creates a Spinner instance with the given value factory set. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final void
void
Attempts to decrement thevalue factory
by one step, by calling theSpinnerValueFactory.decrement(int)
method with an argument of one.void
decrement
(int steps) Attempts to decrement thevalue factory
by the given number of steps, by calling theSpinnerValueFactory.decrement(int)
method and forwarding the steps argument to it.final BooleanProperty
The editable property is used to specify whether user input is able to be typed into the Spinnereditor
.final ReadOnlyObjectProperty
<TextField> The editor used by the Spinner control.static List
<CssMetaData<? extends Styleable, ?>> Gets theCssMetaData
associated with this class, which may include theCssMetaData
of its superclasses.List
<CssMetaData<? extends Styleable, ?>> Gets the unmodifiable list of the control's CSS-styleable properties.final TextField
Gets the value of theeditor
property.final Duration
Gets the value of theinitialDelay
property.final String
Gets the value of thepromptText
property.final Duration
Gets the value of therepeatDelay
property.final T
getValue()
Gets the value of thevalue
property.final SpinnerValueFactory
<T> Gets the value of thevalueFactory
property.void
Attempts to increment thevalue factory
by one step, by calling theSpinnerValueFactory.increment(int)
method with an argument of one.void
increment
(int steps) Attempts to increment thevalue factory
by the given number of steps, by calling theSpinnerValueFactory.increment(int)
method and forwarding the steps argument to it.final ObjectProperty
<Duration> The duration that the mouse has to be pressed on an arrow button before the next value steps.final boolean
Gets the value of theeditable
property.final StringProperty
The prompt text to display in theSpinner
, ornull
if no prompt text is displayed.final ObjectProperty
<Duration> The duration that the mouse has to be pressed for each successive step after the first value steps.final void
setEditable
(boolean value) Sets the value of theeditable
property.final void
setInitialDelay
(Duration value) Sets the value of theinitialDelay
property.final void
setPromptText
(String value) Sets the value of thepromptText
property.final void
setRepeatDelay
(Duration value) Sets the value of therepeatDelay
property.final void
setValueFactory
(SpinnerValueFactory<T> value) Sets the value of thevalueFactory
property.final ObjectProperty
<SpinnerValueFactory<T>> The value factory is the model behind the JavaFX Spinner control - without a value factory installed a Spinner is unusable.final ReadOnlyObjectProperty
<T> The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property
.Methods declared in class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, contextMenuProperty, createDefaultSkin, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
Methods declared in class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computePrefHeight, computePrefWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods declared in class javafx.scene.Parent
getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
Methods declared in class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods declared in interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
value
The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property
. Should thevalue 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);
- See Also:
-
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:- Representing the current state of the
value
, Incrementing
anddecrementing
the value, with one or more steps per call,Converting
text input from the user (via the Spinnereditor
,- Converting
objects to user-readable strings
for display on screen
- See Also:
- Representing the current state of the
-
editable
The editable property is used to specify whether user input is able to be typed into the Spinnereditor
. 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 SpinnerValueFactoryconverter
StringConverter.fromString(String)
method. The returned value from this call (of type T) is then sent to theSpinnerValueFactory.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
- See Also:
-
editor
The editor used by the Spinner control.- See Also:
-
promptText
The prompt text to display in theSpinner
, ornull
if no prompt text is displayed.- Default value:
- Empty string
- Since:
- 9
- See Also:
-
initialDelay
The duration that the mouse has to be pressed on an arrow button before the next value steps. Successive step duration is set usingrepeat delay
.- Default value:
- 300ms
- Since:
- 11
- See Also:
-
repeatDelay
The duration that the mouse has to be pressed for each successive step after the first value steps. Initial step duration is set usinginitial delay
.- Default value:
- 60ms
- Since:
- 11
- See Also:
-
-
Field Details
-
STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTAL
The arrows are placed on the right of the Spinner, pointing horizontally (i.e. left and right).- See Also:
-
STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL
The arrows are placed on the left of the Spinner, pointing vertically (i.e. up and down).- See Also:
-
STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTAL
The arrows are placed on the left of the Spinner, pointing horizontally (i.e. left and right).- See Also:
-
STYLE_CLASS_SPLIT_ARROWS_VERTICAL
The arrows are placed above and beneath the spinner, stretching to take the entire width.- See Also:
-
STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL
The decrement arrow is placed on the left of the Spinner, and the increment on the right.- See Also:
-
-
Constructor Details
-
Spinner
public Spinner()Constructs a default Spinner instance, with the default 'spinner' style class and a non-editable editor. -
Spinner
public Spinner(int min, int max, int initialValue) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.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
- The minimum allowed integer value for the Spinner.max
- The maximum allowed integer value for the Spinner.initialValue
- 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.
-
Spinner
public Spinner(int min, int max, int initialValue, int amountToStepBy) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.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
- The minimum allowed integer value for the Spinner.max
- The maximum allowed integer value for the Spinner.initialValue
- 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
- The amount to increment or decrement by, per step.
-
Spinner
public Spinner(double min, double max, double initialValue) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.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
- The minimum allowed double value for the Spinner.max
- The maximum allowed double value for the Spinner.initialValue
- 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.
-
Spinner
public Spinner(double min, double max, double initialValue, double amountToStepBy) Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.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
- The minimum allowed double value for the Spinner.max
- The maximum allowed double value for the Spinner.initialValue
- 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
- The amount to increment or decrement by, per step.
-
Spinner
Creates a Spinner instance with thevalue factory
set to be an instance ofSpinnerValueFactory.ListSpinnerValueFactory
. The Spinnervalue property
will be set to the first element of the list, if an element exists, or null otherwise.- Parameters:
items
- A list of items that will be stepped through in the Spinner.
-
Spinner
Creates a Spinner instance with the given value factory set.- Parameters:
valueFactory
- Thevalue factory
to use.
-
-
Method Details
-
increment
public void increment()Attempts to increment thevalue factory
by one step, by calling theSpinnerValueFactory.increment(int)
method with an argument of one. If the value factory is null, an IllegalStateException is thrown.- Throws:
IllegalStateException
- if the value factory returned by callinggetValueFactory()
is null.
-
increment
public void increment(int steps) Attempts to increment thevalue factory
by the given number of steps, by calling theSpinnerValueFactory.increment(int)
method and forwarding the steps argument to it. If the value factory is null, an IllegalStateException is thrown.- Parameters:
steps
- The number of increments that should be performed on the value.- Throws:
IllegalStateException
- if the value factory returned by callinggetValueFactory()
is null.
-
decrement
public void decrement()Attempts to decrement thevalue factory
by one step, by calling theSpinnerValueFactory.decrement(int)
method with an argument of one. If the value factory is null, an IllegalStateException is thrown.- Throws:
IllegalStateException
- if the value factory returned by callinggetValueFactory()
is null.
-
decrement
public void decrement(int steps) Attempts to decrement thevalue factory
by the given number of steps, by calling theSpinnerValueFactory.decrement(int)
method and forwarding the steps argument to it. If the value factory is null, an IllegalStateException is thrown.- Parameters:
steps
- The number of decrements that should be performed on the value.- Throws:
IllegalStateException
- if the value factory returned by callinggetValueFactory()
is null.
-
commitValue
public final void commitValue()If the Spinner iseditable
, calling this method will attempt to commit the current text and convert it to avalue
.- Since:
- 9
-
cancelEdit
public final void cancelEdit()If the Spinner iseditable
, calling this method will attempt to replace the editor text with the last committedvalue
.- Since:
- 9
-
getValue
Gets the value of thevalue
property.- Property description:
- The value property on Spinner is a read-only property, as it is bound to
the SpinnerValueFactory
value property
. Should thevalue 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);
- Returns:
- the value of the
value
property - See Also:
-
valueProperty
The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property
. Should thevalue 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);
- Returns:
- the
value
property - See Also:
-
setValueFactory
Sets the value of thevalueFactory
property.- Property description:
- 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:
- Representing the current state of the
value
, Incrementing
anddecrementing
the value, with one or more steps per call,Converting
text input from the user (via the Spinnereditor
,- Converting
objects to user-readable strings
for display on screen
- Representing the current state of the
- Parameters:
value
- the value for thevalueFactory
property- See Also:
-
getValueFactory
Gets the value of thevalueFactory
property.- Property description:
- 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:
- Representing the current state of the
value
, Incrementing
anddecrementing
the value, with one or more steps per call,Converting
text input from the user (via the Spinnereditor
,- Converting
objects to user-readable strings
for display on screen
- Representing the current state of the
- Returns:
- the value of the
valueFactory
property - See Also:
-
valueFactoryProperty
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:- Representing the current state of the
value
, Incrementing
anddecrementing
the value, with one or more steps per call,Converting
text input from the user (via the Spinnereditor
,- Converting
objects to user-readable strings
for display on screen
- Returns:
- the
valueFactory
property - See Also:
- Representing the current state of the
-
setEditable
public final void setEditable(boolean value) Sets the value of theeditable
property.- Property description:
- 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 SpinnerValueFactoryconverter
StringConverter.fromString(String)
method. The returned value from this call (of type T) is then sent to theSpinnerValueFactory.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
- Parameters:
value
- the value for theeditable
property- See Also:
-
isEditable
public final boolean isEditable()Gets the value of theeditable
property.- Property description:
- 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 SpinnerValueFactoryconverter
StringConverter.fromString(String)
method. The returned value from this call (of type T) is then sent to theSpinnerValueFactory.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
- Returns:
- the value of the
editable
property - See Also:
-
editableProperty
The editable property is used to specify whether user input is able to be typed into the Spinnereditor
. 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 SpinnerValueFactoryconverter
StringConverter.fromString(String)
method. The returned value from this call (of type T) is then sent to theSpinnerValueFactory.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
- Returns:
- the
editable
property - See Also:
-
editorProperty
The editor used by the Spinner control.- Returns:
- the editor property
- See Also:
-
getEditor
Gets the value of theeditor
property.- Property description:
- The editor used by the Spinner control.
- Returns:
- the value of the
editor
property - See Also:
-
promptTextProperty
The prompt text to display in theSpinner
, ornull
if no prompt text is displayed.- Default value:
- Empty string
- Returns:
- the prompt text property
- Since:
- 9
- See Also:
-
getPromptText
Gets the value of thepromptText
property.- Property description:
- The prompt text to display in the
Spinner
, ornull
if no prompt text is displayed. - Default value:
- Empty string
- Returns:
- the value of the
promptText
property - Since:
- 9
- See Also:
-
setPromptText
Sets the value of thepromptText
property.- Property description:
- The prompt text to display in the
Spinner
, ornull
if no prompt text is displayed. - Default value:
- Empty string
- Parameters:
value
- the value for thepromptText
property- Since:
- 9
- See Also:
-
initialDelayProperty
The duration that the mouse has to be pressed on an arrow button before the next value steps. Successive step duration is set usingrepeat delay
.- Default value:
- 300ms
- Returns:
- initial delay property
- Since:
- 11
- See Also:
-
setInitialDelay
Sets the value of theinitialDelay
property.- Property description:
- 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
. - Default value:
- 300ms
- Parameters:
value
- the value for theinitialDelay
property- Since:
- 11
- See Also:
-
getInitialDelay
Gets the value of theinitialDelay
property.- Property description:
- 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
. - Default value:
- 300ms
- Returns:
- the value of the
initialDelay
property - Since:
- 11
- See Also:
-
repeatDelayProperty
The duration that the mouse has to be pressed for each successive step after the first value steps. Initial step duration is set usinginitial delay
.- Default value:
- 60ms
- Returns:
- repeat delay property
- Since:
- 11
- See Also:
-
setRepeatDelay
Sets the value of therepeatDelay
property.- Property description:
- 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
. - Default value:
- 60ms
- Parameters:
value
- the value for therepeatDelay
property- Since:
- 11
- See Also:
-
getRepeatDelay
Gets the value of therepeatDelay
property.- Property description:
- 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
. - Default value:
- 60ms
- Returns:
- the value of the
repeatDelay
property - Since:
- 11
- See Also:
-
getClassCssMetaData
Gets theCssMetaData
associated with this class, which may include theCssMetaData
of its superclasses.- Returns:
- the
CssMetaData
- Since:
- 11
-
getControlCssMetaData
Description copied from class:Control
Gets the unmodifiable list of the control's CSS-styleable properties.- Overrides:
getControlCssMetaData
in classControl
- Returns:
- the unmodifiable list of the control's CSS-styleable properties
-