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