I have a LoginDialog. RecoverPasswordDialog will be opened from LoginDialog. I am finding a way to make LoginDialog is the owner of RecoverPasswordDialog.
Here is my code:
public class LoginDialog extends Dialog<String> {
@FXML
public void handleForgotPasswordClick() {
RecoverPasswordDialog dlg = new RecoverPasswordDialog();
dlg.initOwner(LoginDialog.this); // ERROR because LoginDialog is not Window
dlg.show();
}
}
I know I can do like this
dlg.initOwner(primaryStage);
OR
dlg.initOwner(LoginDialog.this.getOwner());
But if I do that, LoginDialog is not the parent of the RecoverPasswordDialog.
Any ideas? Thanks!