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
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
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
SpinnerValueFactory classes for some common types are provided with JavaFX, including:
- Since:
- JavaFX 8u40
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ASpinnerValueFactory
implementation designed to iterate through double values.static class
ASpinnerValueFactory
implementation designed to iterate through integer values.static class
ASpinnerValueFactory
implementation designed to iterate through a list of values. -
Property Summary
TypePropertyDescriptionfinal ObjectProperty
<StringConverter<T>> final ObjectProperty
<T> Represents the current value of the SpinnerValueFactory, or null if no value has been set.final BooleanProperty
Specifies whether thisSpinnerValueFactory
wraps around from the maximum value to the minimum value, and vice versa. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty
<StringConverter<T>> abstract void
decrement
(int steps) Attempts to decrement thevalue
by the given number of steps.final StringConverter
<T> Gets the value of theconverter
property.final T
getValue()
Gets the value of thevalue
property.abstract void
increment
(int steps) Attempts to increment thevalue
by the given number of steps.final boolean
Gets the value of thewrapAround
property.final void
setConverter
(StringConverter<T> newValue) Sets the value of theconverter
property.final void
Sets the value of thevalue
property.final void
setWrapAround
(boolean value) Sets the value of thewrapAround
property.final ObjectProperty
<T> Represents the current value of the SpinnerValueFactory, or null if no value has been set.final BooleanProperty
Specifies whether thisSpinnerValueFactory
wraps around from the maximum value to the minimum value, and vice versa.
-
Property Details
-
value
Represents the current value of the SpinnerValueFactory, or null if no value has been set.- See Also:
-
converter
-
wrapAround
Specifies whether thisSpinnerValueFactory
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:
-
-
Constructor Details
-
SpinnerValueFactory
public SpinnerValueFactory()Creates a default SpinnerValueFactory.
-
-
Method Details
-
decrement
public abstract void decrement(int steps) Attempts to decrement thevalue
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 callingincrement(int)
with the absolute value ofsteps
.
-
increment
public abstract void increment(int steps) Attempts to increment thevalue
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 callingdecrement(int)
with the absolute number ofsteps
.
-
getValue
Gets the value of thevalue
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
Sets the value of thevalue
property.- Property description:
- Represents the current value of the SpinnerValueFactory, or null if no value has been set.
- Parameters:
newValue
- the value for thevalue
property- See Also:
-
valueProperty
Represents the current value of the SpinnerValueFactory, or null if no value has been set.- Returns:
- the
value
property - See Also:
-
getConverter
Gets the value of theconverter
property. -
setConverter
Sets the value of theconverter
property. -
converterProperty
-
setWrapAround
public final void setWrapAround(boolean value) Sets the value of thewrapAround
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 thewrapAround
property- See Also:
-
isWrapAround
public final boolean isWrapAround()Gets the value of thewrapAround
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:
-
wrapAroundProperty
Specifies whether thisSpinnerValueFactory
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:
-