belyid belyid - 11 months ago 64
Java Question

Why am I unable to programmatically close a Dialog on JavaFX?

This sample of code shows but doesn't close a javafx.scene.control.Dialog on JavaFx:

Dialog<Void> dialog = new Dialog<Void>();;


Dialog<Void> dialog = new Dialog<Void>();;


Answer Source

From the javadoc:

More often than not, dialogs are shown in a modal and blocking fashion. 'Modal' means that the dialog prevents user interaction with the owning application whilst it is showing, and 'blocking' means that code execution stops at the point in which the dialog is shown

(emphasis mine)