Class SpinnerValueFactory.IntegerSpinnerValueFactory
- Enclosing class:
SpinnerValueFactory<T>
public static class SpinnerValueFactory.IntegerSpinnerValueFactory extends SpinnerValueFactory<Integer>
SpinnerValueFactory implementation designed to iterate through integer values. If wrapAround is true, the IntegerSpinnerValueFactory will step from the minimum value to the maximum value (and vice versa). As a consequence of that, the number of steps required to wrap around to the same value is N+1, where N is the number of steps between min (inclusive) and max (inclusive). The new value after a step is val = (val + amountToStepBy) % (max - min + 1).
Note that the default converter is implemented as an IntegerStringConverter instance.
- Since:
- JavaFX 8u40
Nested Class Summary
Nested classes/interfaces declared in class javafx.scene.control.SpinnerValueFactory
SpinnerValueFactory.DoubleSpinnerValueFactory, SpinnerValueFactory.IntegerSpinnerValueFactory, SpinnerValueFactory.ListSpinnerValueFactory<T>
Property Summary
| Type | Property | Description |
|---|---|---|
final IntegerProperty |
amountToStepBy |
Sets the amount to increment or decrement by, per step. |
final IntegerProperty |
max |
Sets the maximum allowable value for this value factory |
final IntegerProperty |
min |
Sets the minimum allowable value for this value factory |
Properties declared in class javafx.scene.control.SpinnerValueFactory
converter, value, wrapAround
Constructor Summary
| Constructor | Description |
|---|---|
IntegerSpinnerValueFactory |
Constructs a new IntegerSpinnerValueFactory that sets the initial value to be equal to the min value, and a default amountToStepBy of one. |
IntegerSpinnerValueFactory |
Constructs a new IntegerSpinnerValueFactory with a default amountToStepBy of one. |
IntegerSpinnerValueFactory |
Constructs a new IntegerSpinnerValueFactory. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final IntegerProperty |
amountToStepByProperty() |
Sets the amount to increment or decrement by, per step. |
void |
decrement |
Attempts to decrement the value by the given number of steps. |
final int |
getAmountToStepBy() |
Gets the value of the amountToStepBy property. |
final int |
getMax() |
Gets the value of the max property. |
final int |
getMin() |
Gets the value of the min property. |
void |
increment |
Attempts to increment the value by the given number of steps. |
final IntegerProperty |
maxProperty() |
Sets the maximum allowable value for this value factory |
final IntegerProperty |
minProperty() |
Sets the minimum allowable value for this value factory |
final void |
setAmountToStepBy |
Sets the value of the amountToStepBy property. |
final void |
setMax |
Sets the value of the max property. |
final void |
setMin |
Sets the value of the min property. |
Methods declared in class javafx.scene.control.SpinnerValueFactory
converterProperty, getConverter, getValue, isWrapAround, setConverter, setValue, setWrapAround, valueProperty, wrapAroundProperty
Property Details
min
public final IntegerProperty minProperty
- See Also:
max
public final IntegerProperty maxProperty
- See Also:
amountToStepBy
public final IntegerProperty amountToStepByProperty
- See Also:
Constructor Details
IntegerSpinnerValueFactory
public IntegerSpinnerValueFactory(int min, int max)
amountToStepBy of one.- Parameters:
-
min- The minimum allowed integer value for the Spinner. -
max- The maximum allowed integer value for the Spinner.
IntegerSpinnerValueFactory
public IntegerSpinnerValueFactory(int min, int max, int initialValue)
amountToStepBy of one.- 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.
IntegerSpinnerValueFactory
public IntegerSpinnerValueFactory(int min, int max, int initialValue, int amountToStepBy)
- 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.
Method Details
setMin
public final void setMin(int value)
min property.- Property description:
- Sets the minimum allowable value for this value factory
- Parameters:
-
value- the value for theminproperty - See Also:
getMin
public final int getMin()
min property.- Property description:
- Sets the minimum allowable value for this value factory
- Returns:
- the value of the
minproperty - See Also:
minProperty
public final IntegerProperty minProperty()
- Returns:
- the minimum allowable value for this value factory
- See Also:
setMax
public final void setMax(int value)
max property.- Property description:
- Sets the maximum allowable value for this value factory
- Parameters:
-
value- the value for themaxproperty - See Also:
getMax
public final int getMax()
max property.- Property description:
- Sets the maximum allowable value for this value factory
- Returns:
- the value of the
maxproperty - See Also:
maxProperty
public final IntegerProperty maxProperty()
- Returns:
- the maximum allowable value for this value factory
- See Also:
setAmountToStepBy
public final void setAmountToStepBy(int value)
amountToStepBy property.- Property description:
- Sets the amount to increment or decrement by, per step.
- Parameters:
-
value- the value for theamountToStepByproperty - See Also:
getAmountToStepBy
public final int getAmountToStepBy()
amountToStepBy property.- Property description:
- Sets the amount to increment or decrement by, per step.
- Returns:
- the value of the
amountToStepByproperty - See Also:
amountToStepByProperty
public final IntegerProperty amountToStepByProperty()
- Returns:
- the amount to increment or decrement by, per step
- See Also:
decrement
public void decrement(int steps)
value by the given number of steps.- Specified by:
-
decrementin classSpinnerValueFactory<Integer> - Parameters:
-
steps- The number of decrements that should be performed on the value. If the number is negative, the call is equivalent to callingSpinnerValueFactory.increment(int)with the absolute value ofsteps.
increment
public void increment(int steps)
value by the given number of steps.- Specified by:
-
incrementin classSpinnerValueFactory<Integer> - Parameters:
-
steps- The number of increments that should be performed on the value. If the number is negative, the call is equivalent to callingSpinnerValueFactory.decrement(int)with the absolute number ofsteps.
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.