- java.lang.Object
- 
- javafx.scene.Node
- 
- javafx.scene.Parent
- 
- javafx.scene.layout.Region
- 
- javafx.scene.control.Control
- 
- javafx.scene.control.Spinner<T>
 
 
 
 
 
- 
- 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
 
 public class Spinner<T> extends Control 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 aswrappingand simpler specification of 'infinite' data models (theSpinnerValueFactory, rather than using aObservableListdata 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 thevalue 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 valueof the Spinner, which is called theeditor. By default the Spinner is non-editable, but input can be accepted if theeditable propertyis set to true. The Spinner editor stays in sync with the value factory by listening for changes to thevalue propertyof the value factory. If the user has changed the value displayed in the editor it is possible for the Spinnervalueto 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.- Since:
- JavaFX 8u40
- See Also:
- SpinnerValueFactory
 
- 
- 
Property SummaryProperties Type Property Description BooleanPropertyeditableThe editable property is used to specify whether user input is able to be typed into the Spinnereditor.ReadOnlyObjectProperty<TextField>editorThe editor used by the Spinner control.ObjectProperty<Duration>initialDelayThe duration that the mouse has to be pressed on an arrow button before the next value steps.StringPropertypromptTextThe prompt text to display in theSpinner, ornullif no prompt text is displayed.ObjectProperty<Duration>repeatDelayThe duration that the mouse has to be pressed for each successive step after the first value steps.ObjectProperty<SpinnerValueFactory<T>>valueFactoryThe value factory is the model behind the JavaFX Spinner control - without a value factory installed a Spinner is unusable.ReadOnlyObjectProperty<T>valueThe value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property.- 
Properties inherited from class javafx.scene.control.ControlcontextMenu, skin, tooltip
 - 
Properties inherited from class javafx.scene.layout.Regionbackground, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
 - 
Properties inherited from class javafx.scene.ParentneedsLayout
 - 
Properties inherited from class javafx.scene.NodeaccessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, 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 SummaryFields Modifier and Type Field Description static StringSTYLE_CLASS_ARROWS_ON_LEFT_HORIZONTALThe arrows are placed on the left of the Spinner, pointing horizontally (i.e.static StringSTYLE_CLASS_ARROWS_ON_LEFT_VERTICALThe arrows are placed on the left of the Spinner, pointing vertically (i.e.static StringSTYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTALThe arrows are placed on the right of the Spinner, pointing horizontally (i.e.static StringSTYLE_CLASS_SPLIT_ARROWS_HORIZONTALThe decrement arrow is placed on the left of the Spinner, and the increment on the right.static StringSTYLE_CLASS_SPLIT_ARROWS_VERTICALThe arrows are placed above and beneath the spinner, stretching to take the entire width.- 
Fields inherited from class javafx.scene.layout.RegionUSE_COMPUTED_SIZE, USE_PREF_SIZE
 - 
Fields inherited from class javafx.scene.NodeBASELINE_OFFSET_SAME_AS_HEIGHT
 
- 
 - 
Constructor SummaryConstructors Constructor Description Spinner()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 factoryset to be an instance ofSpinnerValueFactory.DoubleSpinnerValueFactory.Spinner(double min, double max, double initialValue, double amountToStepBy)Creates a Spinner instance with thevalue factoryset to be an instance ofSpinnerValueFactory.DoubleSpinnerValueFactory.Spinner(int min, int max, int initialValue)Creates a Spinner instance with thevalue factoryset to be an instance ofSpinnerValueFactory.IntegerSpinnerValueFactory.Spinner(int min, int max, int initialValue, int amountToStepBy)Creates a Spinner instance with thevalue factoryset to be an instance ofSpinnerValueFactory.IntegerSpinnerValueFactory.Spinner(ObservableList<T> items)Creates a Spinner instance with thevalue factoryset to be an instance ofSpinnerValueFactory.ListSpinnerValueFactory.Spinner(SpinnerValueFactory<T> valueFactory)Creates a Spinner instance with the given value factory set.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelEdit()voidcommitValue()protected Skin<?>createDefaultSkin()Create a new instance of the default skin for this control.voiddecrement()Attempts to decrement thevalue factoryby one step, by calling theSpinnerValueFactory.decrement(int)method with an argument of one.voiddecrement(int steps)Attempts to decrement thevalue factoryby the given number of steps, by calling theSpinnerValueFactory.decrement(int)method and forwarding the steps argument to it.BooleanPropertyeditableProperty()The editable property is used to specify whether user input is able to be typed into the Spinnereditor.ReadOnlyObjectProperty<TextField>editorProperty()The editor used by the Spinner control.voidexecuteAccessibleAction(AccessibleAction action, Object... parameters)This method is called by the assistive technology to request the action indicated by the argument should be executed.static List<CssMetaData<? extends Styleable,?>>getClassCssMetaData()List<CssMetaData<? extends Styleable,?>>getControlCssMetaData()TextFieldgetEditor()Gets the value of the property editor.DurationgetInitialDelay()Gets the value of the property initialDelay.StringgetPromptText()Gets the value of the property promptText.DurationgetRepeatDelay()Gets the value of the property repeatDelay.TgetValue()Gets the value of the property value.SpinnerValueFactory<T>getValueFactory()Gets the value of the property valueFactory.voidincrement()Attempts to increment thevalue factoryby one step, by calling theSpinnerValueFactory.increment(int)method with an argument of one.voidincrement(int steps)Attempts to increment thevalue factoryby the given number of steps, by calling theSpinnerValueFactory.increment(int)method and forwarding the steps argument to it.ObjectProperty<Duration>initialDelayProperty()The duration that the mouse has to be pressed on an arrow button before the next value steps.booleanisEditable()Gets the value of the property editable.StringPropertypromptTextProperty()The prompt text to display in theSpinner, ornullif no prompt text is displayed.ObjectqueryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)This method is called by the assistive technology to request the value for an attribute.ObjectProperty<Duration>repeatDelayProperty()The duration that the mouse has to be pressed for each successive step after the first value steps.voidsetEditable(boolean value)Sets the value of the property editable.voidsetInitialDelay(Duration value)Sets the value of the property initialDelay.voidsetPromptText(String value)Sets the value of the property promptText.voidsetRepeatDelay(Duration value)Sets the value of the property repeatDelay.voidsetValueFactory(SpinnerValueFactory<T> value)Sets the value of the property valueFactory.ObjectProperty<SpinnerValueFactory<T>>valueFactoryProperty()The value factory is the model behind the JavaFX Spinner control - without a value factory installed a Spinner is unusable.ReadOnlyObjectProperty<T>valueProperty()The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property.- 
Methods inherited from class javafx.scene.control.ControlcomputeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
 - 
Methods inherited from class javafx.scene.layout.RegionbackgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, 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 inherited from class javafx.scene.ParentgetChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
 - 
Methods inherited from class javafx.scene.NodeaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, 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, 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, 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, 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 inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface javafx.css.StyleablegetStyleableNode
 
- 
 
- 
- 
- 
Property Detail- 
valuepublic final ReadOnlyObjectProperty<T> valueProperty The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property. Should thevalue factorychange, 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:
- getValue()
 
 - 
valueFactorypublic final ObjectProperty<SpinnerValueFactory<T>> 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,
- Incrementingand- decrementingthe value, with one or more steps per call,
- Convertingtext input from the user (via the Spinner- editor,
- Converting objects to user-readable stringsfor display on screen
 
- Representing the current state of the 
 - 
editablepublic final BooleanProperty 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 SpinnerValueFactoryconverterStringConverter.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.- See Also:
- isEditable(),- setEditable(boolean)
 
 - 
editorpublic final ReadOnlyObjectProperty<TextField> editorProperty The editor used by the Spinner control.- See Also:
- getEditor()
 
 - 
promptTextpublic final StringProperty promptTextProperty The prompt text to display in theSpinner, ornullif no prompt text is displayed.- Since:
- 9
- See Also:
- getPromptText(),- setPromptText(String)
 
 - 
initialDelaypublic 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 usingrepeat delay.- Default value:
- 300ms
- Since:
- 11
- See Also:
- getInitialDelay(),- setInitialDelay(Duration)
 
 - 
repeatDelaypublic 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 usinginitial delay.- Default value:
- 60ms
- Since:
- 11
- See Also:
- getRepeatDelay(),- setRepeatDelay(Duration)
 
 
- 
 - 
Field Detail- 
STYLE_CLASS_ARROWS_ON_RIGHT_HORIZONTALpublic 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).- See Also:
- Constant Field Values
 
 - 
STYLE_CLASS_ARROWS_ON_LEFT_VERTICALpublic 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).- See Also:
- Constant Field Values
 
 - 
STYLE_CLASS_ARROWS_ON_LEFT_HORIZONTALpublic 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).- See Also:
- Constant Field Values
 
 - 
STYLE_CLASS_SPLIT_ARROWS_VERTICALpublic static final String STYLE_CLASS_SPLIT_ARROWS_VERTICAL The arrows are placed above and beneath the spinner, stretching to take the entire width.- See Also:
- Constant Field Values
 
 - 
STYLE_CLASS_SPLIT_ARROWS_HORIZONTALpublic 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.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
Spinnerpublic Spinner() Constructs a default Spinner instance, with the default 'spinner' style class and a non-editable editor.
 - 
Spinnerpublic Spinner(int min, int max, int initialValue)Creates a Spinner instance with thevalue factoryset 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.
 
 - 
Spinnerpublic Spinner(int min, int max, int initialValue, int amountToStepBy)Creates a Spinner instance with thevalue factoryset 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.
 
 - 
Spinnerpublic Spinner(double min, double max, double initialValue)Creates a Spinner instance with thevalue factoryset 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.
 
 - 
Spinnerpublic Spinner(double min, double max, double initialValue, double amountToStepBy)Creates a Spinner instance with thevalue factoryset 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.
 
 - 
Spinnerpublic Spinner(ObservableList<T> items) Creates a Spinner instance with thevalue factoryset to be an instance ofSpinnerValueFactory.ListSpinnerValueFactory. The Spinnervalue propertywill 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.
 
 - 
Spinnerpublic Spinner(SpinnerValueFactory<T> valueFactory) Creates a Spinner instance with the given value factory set.- Parameters:
- valueFactory- The- value factoryto use.
 
 
- 
 - 
Method Detail- 
incrementpublic void increment() Attempts to increment thevalue factoryby 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 calling- getValueFactory()is null.
 
 - 
incrementpublic void increment(int steps) Attempts to increment thevalue factoryby 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 calling- getValueFactory()is null.
 
 - 
decrementpublic void decrement() Attempts to decrement thevalue factoryby 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 calling- getValueFactory()is null.
 
 - 
decrementpublic void decrement(int steps) Attempts to decrement thevalue factoryby 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 calling- getValueFactory()is null.
 
 - 
createDefaultSkinprotected Skin<?> 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-skinor set explicitly in a sub-class withsetSkin(...).- Overrides:
- createDefaultSkinin class- Control
- Returns:
- new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
 
 - 
commitValuepublic final void commitValue() If the Spinner iseditable, calling this method will attempt to commit the current text and convert it to avalue.- Since:
- 9
 
 - 
cancelEditpublic final void cancelEdit() If the Spinner iseditable, calling this method will attempt to replace the editor text with the last committedvalue.- Since:
- 9
 
 - 
getValuepublic final T getValue() Gets the value of the property value.- Property description:
- The value property on Spinner is a read-only property, as it is bound to
 the SpinnerValueFactory
 value property. Should thevalue factorychange, 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);
 
 - 
valuePropertypublic final ReadOnlyObjectProperty<T> valueProperty() The value property on Spinner is a read-only property, as it is bound to the SpinnerValueFactoryvalue property. Should thevalue factorychange, 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:
- getValue()
 
 - 
setValueFactorypublic final void setValueFactory(SpinnerValueFactory<T> value) Sets the value of the property valueFactory.- 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,
- Incrementingand- decrementingthe value, with one or more steps per call,
- Convertingtext input from the user (via the Spinner- editor,
- Converting objects to user-readable stringsfor display on screen
 
- Representing the current state of the 
 
 - 
getValueFactorypublic final SpinnerValueFactory<T> getValueFactory() Gets the value of the property valueFactory.- 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,
- Incrementingand- decrementingthe value, with one or more steps per call,
- Convertingtext input from the user (via the Spinner- editor,
- Converting objects to user-readable stringsfor display on screen
 
- Representing the current state of the 
 
 - 
valueFactoryPropertypublic final ObjectProperty<SpinnerValueFactory<T>> 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,
- Incrementingand- decrementingthe value, with one or more steps per call,
- Convertingtext input from the user (via the Spinner- editor,
- Converting objects to user-readable stringsfor display on screen
 
- Representing the current state of the 
 - 
setEditablepublic final void setEditable(boolean value) Sets the value of the property editable.- 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 SpinnerValueFactoryconverterStringConverter.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.
 
 - 
isEditablepublic final boolean isEditable() Gets the value of the property editable.- 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 SpinnerValueFactoryconverterStringConverter.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.
 
 - 
editablePropertypublic final BooleanProperty 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 SpinnerValueFactoryconverterStringConverter.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.- See Also:
- isEditable(),- setEditable(boolean)
 
 - 
editorPropertypublic final ReadOnlyObjectProperty<TextField> editorProperty() The editor used by the Spinner control.- See Also:
- getEditor()
 
 - 
getEditorpublic final TextField getEditor() Gets the value of the property editor.- Property description:
- The editor used by the Spinner control.
 
 - 
promptTextPropertypublic final StringProperty promptTextProperty() The prompt text to display in theSpinner, ornullif no prompt text is displayed.- Since:
- 9
- See Also:
- getPromptText(),- setPromptText(String)
 
 - 
getPromptTextpublic final String getPromptText() Gets the value of the property promptText.- Property description:
- The prompt text to display in the Spinner, ornullif no prompt text is displayed.
- Since:
- 9
 
 - 
setPromptTextpublic final void setPromptText(String value) Sets the value of the property promptText.- Property description:
- The prompt text to display in the Spinner, ornullif no prompt text is displayed.
- Since:
- 9
 
 - 
initialDelayPropertypublic 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 usingrepeat delay.- Default value:
- 300ms
- Since:
- 11
- See Also:
- getInitialDelay(),- setInitialDelay(Duration)
 
 - 
setInitialDelaypublic final void setInitialDelay(Duration value) Sets the value of the property initialDelay.- 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
- Since:
- 11
 
 - 
getInitialDelaypublic final Duration getInitialDelay() Gets the value of the property initialDelay.- 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
- Since:
- 11
 
 - 
repeatDelayPropertypublic 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 usinginitial delay.- Default value:
- 60ms
- Since:
- 11
- See Also:
- getRepeatDelay(),- setRepeatDelay(Duration)
 
 - 
setRepeatDelaypublic final void setRepeatDelay(Duration value) Sets the value of the property repeatDelay.- 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
- Since:
- 11
 
 - 
getRepeatDelaypublic final Duration getRepeatDelay() Gets the value of the property repeatDelay.- 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
- Since:
- 11
 
 - 
getClassCssMetaDatapublic static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData() 
 - 
getControlCssMetaDatapublic List<CssMetaData<? extends Styleable,?>> getControlCssMetaData() - Overrides:
- getControlCssMetaDatain class- Control
- Returns:
- unmodifiable list of the controls css styleable properties
 
 - 
queryAccessibleAttributepublic Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) 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.- Overrides:
- queryAccessibleAttributein class- Control
- Parameters:
- attribute- the requested attribute
- parameters- optional list of parameters
- Returns:
- the value for the requested attribute
- See Also:
- AccessibleAttribute
 
 - 
executeAccessibleActionpublic void executeAccessibleAction(AccessibleAction action, Object... parameters) 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.- Overrides:
- executeAccessibleActionin class- Control
- Parameters:
- action- the action to execute
- parameters- optional list of parameters
- See Also:
- AccessibleAction
 
 
- 
 
-