SpinnerValueFactory (JavaFX 25)
Description: declaration: module: javafx.controls, package: javafx.scene.control, class: SpinnerValueFactory

# Class SpinnerValueFactory<T>

java.lang.Object
javafx.scene.control.SpinnerValueFactory<T>

Type Parameters:
  `T` - The type of the data this value factory deals with, which must coincide with the type of the Spinner that the value factory is set on.

Direct Known Subclasses:
  `SpinnerValueFactory.DoubleSpinnerValueFactory, SpinnerValueFactory.IntegerSpinnerValueFactory, SpinnerValueFactory.ListSpinnerValueFactory`

public abstract class SpinnerValueFactory<T> extends Object
The SpinnerValueFactory 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` and `decrementing` the value, with one or more steps per call,
- `Converting` text input from the user (via the Spinner `editor`,
- Converting `objects to user-readable strings` for display on screen

SpinnerValueFactory classes for some common types are provided with JavaFX, including:

- `SpinnerValueFactory.IntegerSpinnerValueFactory`
- `SpinnerValueFactory.DoubleSpinnerValueFactory`
- `SpinnerValueFactory.ListSpinnerValueFactory`

Since:
  JavaFX 8u40
See Also:
  - `Spinner`
  - `SpinnerValueFactory.IntegerSpinnerValueFactory`
  - `SpinnerValueFactory.DoubleSpinnerValueFactory`
  - `SpinnerValueFactory.ListSpinnerValueFactory`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `SpinnerValueFactory.DoubleSpinnerValueFactory`
  A `SpinnerValueFactory` implementation designed to iterate through double values.
  `static class`
  `SpinnerValueFactory.IntegerSpinnerValueFactory`
  A `SpinnerValueFactory` implementation designed to iterate through integer values.
  `static class`
  `SpinnerValueFactory.ListSpinnerValueFactory<T>`
  A `SpinnerValueFactory` implementation designed to iterate through a list of values.

- ## Property Summary

  Properties
  Type
  Property
  Description
  `final ObjectProperty<StringConverter<T>>`
  `converter`
  Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
  `final ObjectProperty<T>`
  `value`
  Represents the current value of the SpinnerValueFactory, or null if no value has been set.
  `final BooleanProperty`
  `wrapAround`
  Specifies whether this `SpinnerValueFactory` wraps around from the maximum value to the minimum value, and vice versa.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpinnerValueFactory()`
  Creates a default SpinnerValueFactory.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final ObjectProperty<StringConverter<T>>`
  `converterProperty()`
  Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
  `abstract void`
  `decrement(int steps)`
  Attempts to decrement the `value` by the given number of steps.
  `final StringConverter<T>`
  `getConverter()`
  Gets the value of the `converter` property.
  `final T`
  `getValue()`
  Gets the value of the `value` property.
  `abstract void`
  `increment(int steps)`
  Attempts to increment the `value` by the given number of steps.
  `final boolean`
  `isWrapAround()`
  Gets the value of the `wrapAround` property.
  `final void`
  `setConverter(StringConverter<T> newValue)`
  Sets the value of the `converter` property.
  `final void`
  `setValue(T newValue)`
  Sets the value of the `value` property.
  `final void`
  `setWrapAround(boolean value)`
  Sets the value of the `wrapAround` property.
  `final ObjectProperty<T>`
  `valueProperty()`
  Represents the current value of the SpinnerValueFactory, or null if no value has been set.
  `final BooleanProperty`
  `wrapAroundProperty()`
  Specifies whether this `SpinnerValueFactory` wraps around from the maximum value to the minimum value, and vice versa.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Property Details

  - ### value

    public final ObjectProperty<T> valueProperty
    Represents the current value of the SpinnerValueFactory, or null if no value has been set.
    See Also:
      - `getValue()`
      - `setValue(T)`
      - `valueProperty()`

  - ### converter

    public final ObjectProperty<StringConverter<T>> converterProperty
    Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
    See Also:
      - `getConverter()`
      - `setConverter(StringConverter)`
      - `converterProperty()`

  - ### wrapAround

    public final BooleanProperty wrapAroundProperty
    Specifies whether this `SpinnerValueFactory` wraps around from the maximum value to the minimum value, and vice versa. The semantics of the wrap-around behavior are specified by implementations of this class.
    See Also:
      - `isWrapAround()`
      - `setWrapAround(boolean)`
      - `wrapAroundProperty()`

- ## Constructor Details

  - ### SpinnerValueFactory

    public SpinnerValueFactory()
    Creates a default SpinnerValueFactory.

- ## Method Details

  - ### decrement

    public abstract void decrement(int steps)
    Attempts to decrement the `value` by the given number of steps.
    Parameters:
      `steps` - The number of decrements that should be performed on the value. If the number is negative, the call is equivalent to calling `increment(int)` with the absolute value of `steps`.

  - ### increment

    public abstract void increment(int steps)
    Attempts to increment the `value` by the given number of steps.
    Parameters:
      `steps` - The number of increments that should be performed on the value. If the number is negative, the call is equivalent to calling `decrement(int)` with the absolute number of `steps`.

  - ### getValue

    public final T getValue()
    Gets the value of the `value` property.
    Property description:
      Represents the current value of the SpinnerValueFactory, or null if no value has been set.
    Returns:
      the value of the `value` property
    See Also:
      - `setValue(T)`
      - `valueProperty()`

  - ### setValue

    public final void setValue(T newValue)
    Sets the value of the `value` property.
    Property description:
      Represents the current value of the SpinnerValueFactory, or null if no value has been set.
    Parameters:
      `newValue` - the value for the `value` property
    See Also:
      - `getValue()`
      - `valueProperty()`

  - ### valueProperty

    public final ObjectProperty<T> valueProperty()
    Represents the current value of the SpinnerValueFactory, or null if no value has been set.
    Returns:
      the `value` property
    See Also:
      - `getValue()`
      - `setValue(T)`

  - ### getConverter

    public final StringConverter<T> getConverter()
    Gets the value of the `converter` property.
    Property description:
      Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
    Returns:
      the value of the `converter` property
    See Also:
      - `setConverter(StringConverter)`
      - `converterProperty()`

  - ### setConverter

    public final void setConverter(StringConverter<T> newValue)
    Sets the value of the `converter` property.
    Property description:
      Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
    Parameters:
      `newValue` - the value for the `converter` property
    See Also:
      - `getConverter()`
      - `converterProperty()`

  - ### converterProperty

    public final ObjectProperty<StringConverter<T>> converterProperty()
    Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
    Returns:
      the `converter` property
    See Also:
      - `getConverter()`
      - `setConverter(StringConverter)`

  - ### setWrapAround

    public final void setWrapAround(boolean value)
    Sets the value of the `wrapAround` property.
    Property description:
      Specifies whether this `SpinnerValueFactory` wraps around from the maximum value to the minimum value, and vice versa. The semantics of the wrap-around behavior are specified by implementations of this class.
    Parameters:
      `value` - the value for the `wrapAround` property
    See Also:
      - `isWrapAround()`
      - `wrapAroundProperty()`

  - ### isWrapAround

    public final boolean isWrapAround()
    Gets the value of the `wrapAround` property.
    Property description:
      Specifies whether this `SpinnerValueFactory` wraps around from the maximum value to the minimum value, and vice versa. The semantics of the wrap-around behavior are specified by implementations of this class.
    Returns:
      the value of the `wrapAround` property
    See Also:
      - `setWrapAround(boolean)`
      - `wrapAroundProperty()`

  - ### wrapAroundProperty

    public final BooleanProperty wrapAroundProperty()
    Specifies whether this `SpinnerValueFactory` wraps around from the maximum value to the minimum value, and vice versa. The semantics of the wrap-around behavior are specified by implementations of this class.
    Returns:
      the `wrapAround` property
    See Also:
      - `isWrapAround()`
      - `setWrapAround(boolean)`