-
Bug
-
Resolution: Unresolved
-
P4
-
jfx11, 8, jfx21
-
None
If we have a scene with a ScrollPane root, which has a BorderPane as content, which has a FlowPane as center node, if the padding of the BorderPane is not set, the layout is correct no matter the space available for the FlowPane children: these are arranged properly.
However, when the padding is set, and there is not enough space for the FlowPane arrangement that would be determined _without padding_, the layout of the FlowPane is wrong, scrolling doesn't work properly (first and last nodes can't be reached), and only after a manual resize of the stage is applied, the layout is fixed, and scrolling works fine.
The attached test reproduces the issue.
If we have 830px total width:
- ScrollPane: w: 830px, padding: 1 (by default), available w: 828px, with vertical scrollbar: 14.5px, total available: 813.5 px.
Without padding:
- BorderPane: 813.5px, padding 0px: total available: 813.5 px.
- FlowPane: 813.5px, which is greater than 2 textAreas (400) + hgap (10) = 810px, so that fits in, and flowPane puts 2x2 textAreas.
With padding 1px (see padding1works.png):
- BorderPane: 813.5px, padding 1px: total available: 811.5 px.
- FlowPane: 811.5px, which is greater than 2 textAreas (400) + hgap (10) = 810px, so that fits in, and flowPane puts 2x2 textAreas, as expected.
Running with padding 2px fails:
- BorderPane: 813.5px, padding 2px: total available: 809.5 px.
- FlowPane: 809.5px, which is lower than 2 textAreas (400) + hgap (10) = 810px, so that doesn't fit in, and flowPane puts 4x1 textAreas, as expected. However, the layout is wrong, the first and fourth textArea nodes are not visible, and we can't scroll to either of them (see padding2fails.png). For some reason, the BorderPane layout still corresponds to a 2x2 FlowPane.
Only after a small resizing of the stage, layout gets fixed (see padding2fixed.png), and scrolling works fine.
This issue can be reproduced with any JavaFX version.
However, when the padding is set, and there is not enough space for the FlowPane arrangement that would be determined _without padding_, the layout of the FlowPane is wrong, scrolling doesn't work properly (first and last nodes can't be reached), and only after a manual resize of the stage is applied, the layout is fixed, and scrolling works fine.
The attached test reproduces the issue.
If we have 830px total width:
- ScrollPane: w: 830px, padding: 1 (by default), available w: 828px, with vertical scrollbar: 14.5px, total available: 813.5 px.
Without padding:
- BorderPane: 813.5px, padding 0px: total available: 813.5 px.
- FlowPane: 813.5px, which is greater than 2 textAreas (400) + hgap (10) = 810px, so that fits in, and flowPane puts 2x2 textAreas.
With padding 1px (see padding1works.png):
- BorderPane: 813.5px, padding 1px: total available: 811.5 px.
- FlowPane: 811.5px, which is greater than 2 textAreas (400) + hgap (10) = 810px, so that fits in, and flowPane puts 2x2 textAreas, as expected.
Running with padding 2px fails:
- BorderPane: 813.5px, padding 2px: total available: 809.5 px.
- FlowPane: 809.5px, which is lower than 2 textAreas (400) + hgap (10) = 810px, so that doesn't fit in, and flowPane puts 4x1 textAreas, as expected. However, the layout is wrong, the first and fourth textArea nodes are not visible, and we can't scroll to either of them (see padding2fails.png). For some reason, the BorderPane layout still corresponds to a 2x2 FlowPane.
Only after a small resizing of the stage, layout gets fixed (see padding2fixed.png), and scrolling works fine.
This issue can be reproduced with any JavaFX version.
- relates to
-
JDK-8315419 ScrollPane: incorrect preferred size with ScrollBarPolicy.NEVER
- Open
- links to
-
Review openjdk/jfx/1203