title: How can I make a JavaFX confirmation alert box wait till OK is pressed but perform other actions when other buttons are pressed
body: <p>I am writing a Java program in which at a certain point, a new directory has to be created. However, there should be an alert message whether the user wants to continue or not. The alert box has to contain the options to<br><br>
  1. Proceed<br>
  2. Discontinue<br>
  3. Show the targeted directory in Windows explorer.<br>
  <br>
  I have already created an alert confirmation box (the method returns whether the program can proceed to move files to the targeted directory):</p>
  
  <pre><code>private static boolean createDir(Movie movie){
      String name = movie.name.getValue();
      File file = new File(Paths.get(target.getValue(),name).toString());
      if(!file.isDirectory()) {
          file.mkdir();
          return true;
      }
      else{
          Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
          alert.setTitle("Duplicate");
          alert.setHeaderText("This folder already exists");
          alert.setContentText("Do you want to continue (this program will overwrite any files with duplicate names)");
  
          ButtonType show = new ButtonType("Show in Explorer");
          alert.getButtonTypes().add(show);
  
          Optional&lt;ButtonType&gt; option = alert.showAndWait();
  
          if (option.get() == null) {
              return false;
          } else if (option.get() == ButtonType.OK) {
              return true;
          } else if (option.get() == ButtonType.CANCEL) {
              return false;
          } else if (option.get() == show) {
              try {
                  Desktop.getDesktop().open(new File(file.getPath()));
              } catch (IOException e) {
                  e.printStackTrace();
              }
          } else {
              return false;
          }
      }
      return  false;
  }
  </code></pre>
  
  <p>The problem is, that I want the alert box to stay on screen when the users clicks on "Show in Explorer". The user will look at the already existing folder and then click OK or cancel (or again show in Explorer).</p>
  
  <p>Thanks in advance :)</p>