title: JavaFX ScrollPane doesnt fit to width
body: <p>I have a ScrollPane with a Pane inside. Initially the Pane is empty, but I add some ImageViews to it dynamically (vertically ordered). The images should be resized so that they fit into the ScrollPane without having to scroll horizontally. This is what I do so far:</p>
  
  <pre><code>// Pane that is content of ScrollPane and member variable of object
  private MigPane imagesPane = new MigPane("fill");
  ...
  // creating ScrollPane in some method and add to current view
  ScrollPane spImages = new ScrollPane();
  spImages.setContent(imagesPane);
  spImages.setFitToWidth(true);
  add(spImages, "wrap");
  ...
  // adding images in another method
  getPm().getImages().forEach(image -&gt; {
          ImageView img = new ImageView(image);
          img.setPreserveRatio(true);
          img.fitWidthProperty().bind(imagesPane.widthProperty());
          imagesPane.add(img, "wrap");
      });
  </code></pre>
  
  <p>That doesn't resize the image so that it fits to the ScrollPane's width, but why? What am I missing?</p>