code: private void setupClose() {
      this.getButtonTypes().add(ButtonType.CLOSE);
      Node closeButton = dialog.getDialogPane().lookupButton(ButtonType.CLOSE);
      closeButton.managedProperty().bind(closeButton.visibleProperty());
      closeButton.setVisible(false);
    }
docs: Instantiates a close button and makes it invisible.
  Dialog requires at least one button to close the dialog window.
  
  @see <a href="https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Dialog.html">
  javafx.scene.control.Dialog</a>
  Chapter: Dialog Closing Rules