I'm wondering how to set the value of a JavaFX Spinner directly from the UI. As I have it now, I have to use the buttons up and down to change it, when I set directly it's not being updated.
I know with Swing you can just use spinner#setValue but it seems to be different with JavaFX.
Fxml:
<Spinner fx:id="spinnerClusters" editable="true" prefHeight="25.0" prefWidth="107.0">
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Spinner>
Controller:
public void initialize(URL url, ResourceBundle rb) {
spinnerClusters.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 100, 0));
}
////
int value = spinnerNBClusters.getValue();
How can I make the value change if the user inputs it directly into the spinner field?