2

I'm using JFXDialog in my program to show that the program's main function is loading. I use the JFXSpinner to show this. The issue is that when the loading dialog is shown, it can be closed when clicked anywhere outside the dialogue. I tried using the 3rd constructor of JFXDialog where you set overlayClose, however whether I set it to true or false, it changes nothing.

Does anyone happen to know what can be done to prevent the dialog from being closed when clicking away?

1 Answers1

5

As written in JFXDialog.java source file:

/**
 * indicates whether the dialog will close when clicking on the overlay or not
 *
 * @return
 */
private BooleanProperty overlayClose = new SimpleBooleanProperty(true);

public final BooleanProperty overlayCloseProperty() {
    return this.overlayClose;
}

public final boolean isOverlayClose() {
    return this.overlayCloseProperty().get();
}

public final void setOverlayClose(final boolean overlayClose) {
    this.overlayCloseProperty().set(overlayClose);
}

You should use yourDialog.setOverlayClose(false);

1w3j
  • 566
  • 8
  • 24