I created the root FXML, which is a BorderPane, and it has its own root controller. I want to dynamically add FXML to the center of this border region.
Each of these fxml uses the same controller, the root controller. I did this in netbeans, choosing the exsisting controller when creating an empty FXML file.
I also gave the nodes different identifier names, but the root controller does not recognize the nodes in these fxml files.
Is it possible to use the same controller for different fxml?
Thanks in advance
Background
I do not know that it is recommended to use an instance of the controller, at least I have never seen it before.
fxml, , , , , ( ) (, , , ).
, , .
, , fxml. , , idempotent.
. .
.
MyController controller = new MyController();
fxml.
FXMLLoader loader = new FXMLLoader(); loader.setController(controller); Panel panel = (Panel) loader.load("myfxml.fxml");
3 fxml .
. factory.
factory fxml factory .