I have two stages
Stage1 with Scene1 and own Controller1
and
Stage2 with another Scene2 and Controller2
From Stage1 i call Stage2 with ShowAndWait.
And set for Stage2 listener for Hiding stage.
From Stage2.Controller2 a call hide and breakpointed in
setOnHiding(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
System.out.print(t.getSource());
}
});
How i can passing paramers between this stages in cases:
1. stage1 pass to stage2
2. stage2 result some data params to stage1
?
This is my solution:
I have 2 class MyStage and MyController
Stage1, Stage2 should extend MyStage
Controller1, Controller2 should extend MyController
it’s general but there are some minor changes to the code when using fxml vs non-fxml.
You can pass stage references to controller to close the stage from another controller.
I am too sleepy now, hope there’s no error.
I will update later