-
Bug
-
Resolution: Fixed
-
P4
-
8
-
Windows 8.1 64bit
FlowPane in horizontal mode uses the same value for prefHeight and minHeight.
I do not understand how can a FlowPane be rendered smaller than its minHeight (but enough to display its content) inside a VBox, while it can not inside a ListCell.
The following code shows that a FlowPane inside a VBox will be rendered and resized appropriately. However, inside a ListCell, the ListCell will always resize using the FlowPane's minHeight, causing an ugly experience!
FlowPane flowPane = new FlowPane();
flowPane.setPrefWidth(50);
flowPane.setPrefWrapLength(50);
flowPane.setVgap(5);
flowPane.setHgap(5);
flowPane.setMaxWidth(Double.MAX_VALUE);
Button button = new Button("Click Me!");
button.setOnAction(evt -> {
flowPane.getChildren().add(new Button("Button"));
});
flowPane.getChildren().add(button);
VBox vBox = new VBox(new Label("I am (and will stay) right after the FlowPane"));
ListView<FlowPane> listView = new ListView<>();
Tab tab1 = new Tab("ListCell");
tab1.setContent(listView);
tab1.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
vBox.getChildren().remove(flowPane);
listView.getItems().add(flowPane);
}
});
Tab tab2 = new Tab("VBox");
tab2.setContent(vBox);
tab2.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
listView.getItems().remove(flowPane);
vBox.getChildren().add(0, flowPane);
}
});
TabPane tabPane = new TabPane();
tabPane.getTabs().addAll(tab1,tab2);
primaryStage.setScene(new Scene(tabPane));
primaryStage.show();
I do not understand how can a FlowPane be rendered smaller than its minHeight (but enough to display its content) inside a VBox, while it can not inside a ListCell.
The following code shows that a FlowPane inside a VBox will be rendered and resized appropriately. However, inside a ListCell, the ListCell will always resize using the FlowPane's minHeight, causing an ugly experience!
FlowPane flowPane = new FlowPane();
flowPane.setPrefWidth(50);
flowPane.setPrefWrapLength(50);
flowPane.setVgap(5);
flowPane.setHgap(5);
flowPane.setMaxWidth(Double.MAX_VALUE);
Button button = new Button("Click Me!");
button.setOnAction(evt -> {
flowPane.getChildren().add(new Button("Button"));
});
flowPane.getChildren().add(button);
VBox vBox = new VBox(new Label("I am (and will stay) right after the FlowPane"));
ListView<FlowPane> listView = new ListView<>();
Tab tab1 = new Tab("ListCell");
tab1.setContent(listView);
tab1.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
vBox.getChildren().remove(flowPane);
listView.getItems().add(flowPane);
}
});
Tab tab2 = new Tab("VBox");
tab2.setContent(vBox);
tab2.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
listView.getItems().remove(flowPane);
vBox.getChildren().add(0, flowPane);
}
});
TabPane tabPane = new TabPane();
tabPane.getTabs().addAll(tab1,tab2);
primaryStage.setScene(new Scene(tabPane));
primaryStage.show();
- relates to
-
JDK-8094178 [VirtualFlow] Viewport breadth is computed incorrectly in the first pass and the value is used in cell height computation
- Resolved