I am creating an application in JavaFx, In which I want to do that if any child stage is getting opened then it should be opened in center of parent stage.
I am trying to do this using mystage.centerOnScreen()
but it'll assign the child stage to center of screen, not the center of parent stage.
How can I assign the child stage to center of parent stage?
private void show(Stage parentStage) {
mystage.initOwner(parentStage);
mystage.initModality(Modality.WINDOW_MODAL);
mystage.centerOnScreen();
mystage.initStyle(StageStyle.UTILITY);
mystage.show();
}