C
C
Chvalov2016-04-12 03:47:51
Java
Chvalov, 2016-04-12 03:47:51

Spinner in JavaFX, how to assign SpinnerValueFactory.IntegerSpinnerValueFactory?

Tell me which way to dig.
There is a scene in which the spinner itself is located (screen.fxml)

<Spinner fx:id="SpinnerRequests" layoutX="127.0" layoutY="78.0" />
There is a controller in which I have to work with this spinner.
import javafx.fxml.FXML;
import javafx.scene.control.Spinner;

public class Controller {
    @FXML public Spinner SpinnerRequests;

}

But no matter how I tried, assigning a spinner IntegerSpinnerValueFactorydoes not work.
In general, it must be said that the spinner:
IntegerSpinnerValueFactory(int min, int max, int initialValue)

How to do it right?
And also advise reading, preferably in Russian on FX8, otherwise there is very little material on the network :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Riard Brugekaaim, 2016-04-17
@Chvalov

When creating an instance of the controller, FXMLLoader itself creates the necessary objects and writes them to variables. You cannot overwrite them, because. the new object will not be associated with the interface.
The compiler cursed @Override because your controller did not implement the Initializable interface, you need to add this text after the controller class name: implements Initializable . An annotation should also be left.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question