JFXDialog cannot set StackPane to not visible
Basically this is my codes and I already have a StackPane in my fxml file. However, I do not have the permissions to change the codes for the Overlay. Hence if I click on the overlay instead, it will block the everything on my screen. Would there be another way to do this or it would be good if I can "customize" the actions I can do when the overlay is clicked. Thank you!
StackPane.setVisible(true);
String title = "";
String content = "Please fill up all fields!";
JFXDialogLayout dialogContent = new JFXDialogLayout();
dialogContent.setHeading(new Text(title));
dialogContent.setBody(new Text(content));
JFXButton close = new JFXButton("Close");
close.setButtonType(JFXButton.ButtonType.RAISED);
close.setStyle("-fx-background-color: #00bfff;");
dialogContent.setActions(close);
JFXDialog dialog = new JFXDialog(StackPane, dialogContent, JFXDialog.DialogTransition.BOTTOM);
close.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
dialog.close();
StackPane.setVisible(false);
}
});
dialog.show();
Not sure I have understood what you are trying to achieve, but you can try using JFXAlert instead of JFXDialog.
Hmmm. Basically it is somthing like this. Link attached below. However, when you click on the overlay, it blocks everything behind it, becuase I loaded my dialog on a StackPane and the StackPane isn't closed when the overlay closes. Thanks! https://camo.githubusercontent.com/bf902c2e387f481b61dd9e494770e1cc236e33eb/687474703a2f2f6a666f656e69782e636f6d2f6769662f6469616c6f672e676966
Let me try JFXAlert first. Will update again. Thanks!
Ok JFXAlert works too. It's also easier to implement than JFXDialog which had to be loaded on a StackPane first. Maybe edit this, the JFXDialog on the ReadMe to say it is JFXAlert instead? I was not aware of JFXAlert at first and from what I see JFXDialog seems to be a child of Alert when being used. Cheers!
Any possibility of an update of this for better clarity? Thanks!