title: JavaFX: How to disable a button for a specific amount of time?
body: <p>I want to disable a button for a specific time in JavaFX application. Is there any option to do this? If not, is there any work around for this?</p>
  
  <p>Below is my code in application. I tried <code>Thread.sleep</code>, but i know this is not the good way to stop the user from clicking on next button.</p>
  
  <pre><code>nextButton.setDisable(true);
  final Timeline animation = new Timeline(
          new KeyFrame(Duration.seconds(delayTime),
          new EventHandler&lt;ActionEvent&gt;() {
              @Override
              public void handle(ActionEvent actionEvent) {
                  nextButton.setDisable(false);
              }
          }));
  animation.setCycleCount(1);
  animation.play();
  </code></pre>