I'm using javaFX. I have an FXML layout with no controller that includes two layouts like so
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<StackPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<fx:include source="/views/partials/message.fxml" />
<fx:include source="/views/common/Customer.fxml" />
</StackPane>
</children>
</VBox>
Each of the nested (FXML) have their own controller. The parent VBOX is loaded and rendered by a third class (not a dedicated controller).
I want to be able to access the controller for the message.fxml from external controllers. So I did the following.
FXMLLoader messageLoader = new FXMLLoader();
messageLoader.setLocation(getClass().getResource("/views/partials/message.fxml"));
Pane pane = messageLoader.load();
MessageController messageController = messageLoader.getController();
but now my problem is that the controller is not executing changes (e.g setting text and making visible or invisible) that I make on the 'message.fxml' even though I can see by using System.out.printLn that the messageController.anyMethod() are being executed but it does not appear to show any results on my layout when I run the app.
Is there a solution for this??