title: JavaFX ScrollPane [ setPrefSize, setMinSize, setMaxSize ] not working
body: <p>I'm writing a GUI application with a ScrollPane, but had some issues with resizing. I extracted the essential code in the following example:</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.geometry.Bounds;
  import javafx.geometry.Pos;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.stage.Stage;
  import javafx.scene.layout.VBox;
  import javafx.scene.control.ScrollPane;
  
  public class JavaFXExample extends Application {
  
      final int width = 300;
      final int height = 300;
  
      @Override
      public void start(Stage primaryStage) {
  
          Button b = new Button("This should be at the bottom!");
  
          //this vbox goes inside the scrollpane
          VBox boxInScrollPane = new VBox(10);
          boxInScrollPane.setAlignment(Pos.BOTTOM_CENTER);
          boxInScrollPane.getChildren().add(b);
  
          //main content
          ScrollPane scrollPane = new ScrollPane();
          scrollPane.setContent(boxInScrollPane);
          scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
          scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
  
          //Doesn't do anything!
          scrollPane.setPrefSize(100, 100);
          scrollPane.setMaxSize(100, 100);
          scrollPane.setMinSize(100, 100);
  
          Scene scene = new Scene(scrollPane, width, height);
  
          primaryStage.setScene(scene);
          primaryStage.show();
  
  
          //set size of boxInScrollPane to be equal to the viewport
          Bounds viewportBounds = scrollPane.getViewportBounds();
          double innerWidth = viewportBounds.getMaxX() - viewportBounds.getMinX();
          double innerHeight = viewportBounds.getMaxY() - viewportBounds.getMinY();
          System.out.println(innerWidth + " " + innerHeight);
          boxInScrollPane.setPrefSize(innerWidth, innerHeight);
  
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>So I have a window, which contains a ScrollPane, which contains a VBox, which contains a button. The example here, where I resize the scrollpane to be 100x100px in a 300x300px window, is arbitrary. What's important is that when I run this code, I get a scrollpane that fills the entire window! Here's my output:</p>
  
  <p><a href="https://i.stack.imgur.com/A9z7E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A9z7E.png" alt=""></a></p>
  
  <p>What's going on here?</p>