I want to use a FX8 Spinner
control, but I want to bind the source to an IntegerProperty
int MIN = 0;
int MAX = 5000;
int STEP = 500;
IntegerProperty integerProperty = new SimpleIntegerProperty();
Spinner<Integer> spinner = new Spinner<>(MIN, MAX, STEP);
I understand the binding is set via binding to the valueProperty
in the Value Factory. However this expects Property<Integer>
and I cannot find a way to cast between IntegerProperty
and Property<Integer>
.
Obviously the below generates a compiler error:
spinner.getValueFactory().valueProperty().bindBidirectional(integerProperty);
Do I need to manually assign a change listener for both directions? Surely there is a neater solution using the valueProperty
, this cannot have been an unforeseen situation.