So I have this line of code which shows a Dialog:
public void showInfoDialog(String header,String message) {
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text(header));
content.setBody(new Text(message));
JFXDialog dialog = new JFXDialog(mySP,content, JFXDialog.DialogTransition.CENTER);
dialog.setMinHeight(mySP.getPrefHeight());
dialog.setMinWidth(mySP.getPrefWidth());
JFXButton button = new JFXButton("OK");
button.setOnAction((ActionEvent event) -> {
dialog.close();
});
content.setActions(button);
dialog.show();
}
And that is leading to this output:
How can I adjust the height and width of the dialog so I can't see the grey background of my stackpane
You can just set a maximum size for the Dialog, or simply adjust the size of the
stackPane
you set for reference.Try to add this to your code:
It'll just adjust the size of your
stackPane
and make it as the same size of your dialog.