title: I'm having a hard time getting some elements to resize in JavaFX
body: <p>I have a series of elements I wish to resize dynamically.</p>
  
  <p>I have a small <code>StackPane</code> set within a larger <code>AnchorPane</code>. The <code>AnchorPane</code> resizes based on the window size changing. I am trying to resize the <code>StackPane</code> to stay the same size relative to the size it was before the <code>AnchorPane</code> resized.</p>
  
  <p>Basically, if my <code>AnchorPane</code> is 1000px and my <code>Stackpane</code> is 100px, if the <code>AnchorPane</code> enlarges to 1200px, my <code>StackPane</code> should be 120px.</p>
  
  <pre><code>ChangeListener parentResized = new ChangeListener&lt;Number&gt;() {
      @Override
      public void changed(ObservableValue&lt;? extends Number&gt; oe, Number oldVal, Number newVal) {
          double diffBetween = sc.getWidth() / parent.getWidth();
          double toAdd = (newVal.doubleValue() - oldVal.doubleValue()) * diffBetween;
          sc.setPrefWidth(sc.getWidth() + toAdd);
      }
  };
  </code></pre>
  
  <p>I cannot work out how to do this using my <code>ChangeListener</code>; the <code>oldVal</code>/<code>newVal</code> updates very quickly.</p>
  
  <p>I am getting an odd issue where it seems to resize properly upon widening, however if I drag slowly enough when narrowing, the element doesn't resize at all.</p>