title: Make JavaFX wait and continue with code
body: <p>Basically I am trying to make a short effect using JavaFX. I have the shape of a heart (added together from two circles and a polygon) that I can vary in size using the double value <code>p</code>. "Standart Size" would be <code>p = 1.0;</code>. </p>
  
  <p>I am trying to add a pumping effect to the heart. I have the method <code>pumpOnce()</code>:</p>
  
  <pre><code>public void pumpOnce(){
      p = p + 1;
      initHeart();
      //Here goes what ever it takes to make stuff working!!
      p = p - 1;
      initHeart();
  }
  </code></pre>
  
  <p><code>initHeart()</code> draws the heart based on <code>p</code>.</p>
  
  <p>I have found out that <code>Thread.sleep();</code> or similar methods will not work due to the thread philosophy in JavaFX.</p>
  
  <p>But what can I use instead?</p>