Spec-Zone.ru › OpenJavaFX 24

Class SpinnerValueFactory.ListSpinnerValueFactory<T>

java.lang.Object
javafx.scene.control.SpinnerValueFactory<T>
javafx.scene.control.SpinnerValueFactory.ListSpinnerValueFactory<T>
Type Parameters:
T - The type of the elements in the List.
Enclosing class:
SpinnerValueFactory<T>
public static class SpinnerValueFactory.ListSpinnerValueFactory<T> extends SpinnerValueFactory<T>
A SpinnerValueFactory implementation designed to iterate through a list of values.

Note that the default converter is implemented simply as shown below, which may be adequate in many cases, but it is important for users to ensure that this suits their needs (and adjust when necessary):

 setConverter(new StringConverter<T>() {
     @Override public String toString(T value) {
         if (value == null) {
             return "";
         }
         return value.toString();
     }

     @Override public T fromString(String string) {
         return (T) string;
     }
 });
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 ObjectProperty<ObservableList<T>> items
The underlying data model for the ListView.

Properties declared in class javafx.scene.control.SpinnerValueFactory

converter, value, wrapAround

Constructor Summary

Constructor Description
ListSpinnerValueFactory(ObservableList<T> items)
Creates a new instance of the ListSpinnerValueFactory with the given list used as the list to step through.

Method Summary

Modifier and Type Method Description
void decrement(int steps)
Attempts to decrement the value by the given number of steps.
final ObservableList<T> getItems()
Returns an ObservableList that contains the items currently able to be iterated through by the user.
void increment(int steps)
Attempts to increment the value by the given number of steps.
final ObjectProperty<ObservableList<T>> itemsProperty()
The underlying data model for the ListView.
final void setItems(ObservableList<T> value)
Sets the underlying data model for the ListSpinnerValueFactory.

Methods declared in class javafx.scene.control.SpinnerValueFactory

converterProperty, getConverter, getValue, isWrapAround, setConverter, setValue, setWrapAround, valueProperty, wrapAroundProperty

Methods declared in class java.lang.Object

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

Property Details

items

public final ObjectProperty<ObservableList<T>> itemsProperty
The underlying data model for the ListView. Note that it has a generic type that must match the type of the ListView itself.
See Also:
  • getItems()
  • setItems(ObservableList)
  • itemsProperty()

Constructor Details

ListSpinnerValueFactory

public ListSpinnerValueFactory(ObservableList<T> items)
Creates a new instance of the ListSpinnerValueFactory with the given list used as the list to step through.
Parameters:
items - The list of items to step through with the Spinner.

Method Details

setItems

public final void setItems(ObservableList<T> value)
Sets the underlying data model for the ListSpinnerValueFactory. Note that it has a generic type that must match the type of the Spinner itself.
Parameters:
value - the list of items

getItems

public final ObservableList<T> getItems()
Returns an ObservableList that contains the items currently able to be iterated through by the user. This may be null if setItems(javafx.collections.ObservableList) has previously been called, however, by default it is an empty ObservableList.
Returns:
An ObservableList containing the items to be shown to the user, or null if the items have previously been set to null.

itemsProperty

public final ObjectProperty<ObservableList<T>> itemsProperty()
The underlying data model for the ListView. Note that it has a generic type that must match the type of the ListView itself.
Returns:
the list of items
See Also:
  • getItems()
  • setItems(ObservableList)

decrement

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

increment

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

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 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.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API