I have a parent controller say HomeController
It has a node SidePanel
(JFXDrawer) with SidePanelController
and a node anchorPane
with varying controller
.
HomeController
|
/ \
/ \
/ \
anchorPane SidePanel
(Controller (Controller = SidePanelController)
= varies)
The anchorPane
node should load multiple fxml views with menu buttons clicked from SidePanelController
.
The problem here is in SidePanelController
since the buttons are inside it, I cannot directly load onanchorPane
as for SidePanelController
the node anchorPane
does not exists
This question seems duplicate of this but its not because the parent controller is waiting for scene to close so it fetches back the data to parent controller. But in my case, every time I click on menu button, it will load a view accordingly.
Can anybody provide resources for making controller for JFXDrawer (as child node).
If say, I have a side navigation drawer sidepanel.fxml
like this
And I have a HomeScreen
like this
So by using following code, I stacked drawer in my homecontroller
try {
SidePanelController controller = new SidePanelController();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/sidepanel.fxml"));
loader.setController(controller);
Parent root = loader.load();
drawer.setSidePane(root);
} catch (IOException err) {
err.printStackTrace();
}
Finally, I will be getting this as combined output
Now what I want is whenever I try to click on say Lorry Receipt
button on Side Navigation Panel, it should trigger the node residing on Parent controller. Even the event which will pass data back to parent controller without closing the child node will work.