title: Keep showing a dialog when validation of input fails
body: <p>I currently have a dialog with four TextFields from which the input is collected. When the input can not meet my requirements, the dialog should stay open and show an error message. I currently have the following code:</p>
  
  <pre><code>dlg.setResultConverter(dialogButton -&gt; {
  
      if (dialogButton == createButtonType) {
  
          ArrayList&lt;String&gt; returnList = getInput();
  
          if (returnList != null) {
              return returnList;
          }
          else {
              dlg.showAndWait();
          }
  
      }
      return null;
  });
  
  Optional&lt;ArrayList&lt;String&gt;&gt; result = dlg.showAndWait();
  result.ifPresent(customerDetails -&gt; {
  
      //Use the input for something
  
  });
  </code></pre>
  
  <p>The <code>getInput()</code> method gets the text from the TextFields and tests it against some requirements. When the input passes, the four Strings are put in an <code>ArrayList&lt;String&gt;</code>. Else, the method returns <code>null</code>. As you can see, the result converter checks if the method returned <code>null</code>. If it didn't, it just returns the <code>ArrayList&lt;String&gt;</code>. </p>
  
  <p>But, when the validation fails, the dialog should be kept open. It works with <code>dlg.showAndWait()</code>, but the downside is that it triggers an error: <code>java.lang.IllegalStateException: Stage already visible</code>. (it keeps working, but getting an error is not the way it should be)</p>
  
  <p>My question is: does anyone know how to do this, without triggering an error?</p>
  
  <p>Note: I am using JavaFX 8 (JDK 1.8.0_40), which has the dialog features built in.</p>