JavaFX FXML Dialog - can't close it with the X button
<p>I'm expected to finish a JavaFX dialog. I added the controller class to the ready FXML</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;?import java.net.*?&gt;
&lt;?import javafx.geometry.*?&gt;
&lt;?import javafx.scene.control.*?&gt;
&lt;?import javafx.scene.layout.*?&gt;
&lt;?import javafx.scene.text.*?&gt;
&lt;?import javafx.scene.image.*?&gt;
&lt;?import javafx.scene.image.Image?&gt;


&lt;Dialog fx:id="dialog"
    fx:controller="myapp.AddDialogController"
    xmlns:fx="http://javafx.com/fxml"&gt;
    &lt;dialogPane&gt;
        &lt;DialogPane prefWidth="400.0" prefHeight="300.0"&gt;
            &lt;stylesheets&gt;
                &lt;URL value="@/css/styles.css" /&gt;
            &lt;/stylesheets&gt;
            &lt;content&gt;
                &lt;VBox&gt;
                    &lt;Label text="Add some content here..."&gt;&lt;/Label&gt;
                &lt;/VBox&gt;
            &lt;/content&gt;
        &lt;/DialogPane&gt;
    &lt;/dialogPane&gt;
&lt;/Dialog&gt;
</code></pre>

<p>Now, when I'm trying to close the dialog with the X button provided by my desktop environment, nothing happens. What am I doing wrong?</p>