0

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: dialog

How can I adjust the height and width of the dialog so I can't see the grey background of my stackpane

Jai
  • 8,165
  • 2
  • 21
  • 52
kokos123
  • 305
  • 3
  • 11

1 Answers1

0

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:

dialog.setMaxSize(100, 100); //For example

It'll just adjust the size of your stackPane and make it as the same size of your dialog.

Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42