[ScrollPane] incorrect preferred size when viewport pref size is specified and bar is present

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 8u20
    • Affects Version/s: None
    • Component/s: javafx
    • None

      The folllowing sample demonstrates the issue.
      Clicking on the scrollpane shows viewport bounds that are not of the size requested. This is because bars are not included in preferred size of the scrollpane.


          @Override public void start(Stage stage) {
              VBox root = new VBox();
              root.setFillWidth(false);

              ScrollPane scrollPane = new ScrollPane(new VBox(new Rectangle(100, 100, Color.RED), new Rectangle(100, 100, Color.BLUE)));
              scrollPane.setPrefViewportHeight(100);
              scrollPane.setPrefViewportWidth(90);

              scrollPane.setOnMouseClicked((ev) -> System.out.println(scrollPane.getViewportBounds()));

              root.getChildren().add(scrollPane);

              Scene scene = new Scene(root, 200, 200);

              stage.setTitle("Hello ScrollPane");
              stage.setScene(scene);
              stage.show();
          }

            Assignee:
            David Grieve
            Reporter:
            Martin Sládeček
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: