I need to change text on action in my second Pane
. For that I tried using:
try{
HouseDA.setDefault(house);
FXMLLoader loader = new FXMLLoader(); //Loads an object hierarchy from an XML document.
loader.setLocation(MainApp.class.getResource("view/MainSideMenu.fxml")); // which document
loader.load();
MainSideMenuController controller = loader.<MainSideMenuController>getController();
controller.refreshHouseInfo();
}catch(Exception e){}
Code works perfectly fine, but text isn't changing. After debugging it looks like it creates another instance of my Pane
and changes text in there. How can I access controller of my existing Pane so that I can change text?