Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8095022

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

    XMLWordPrintable

    Details

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

      Description

      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();
          }

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: