Hi,

I took a quick jab at this issue [1]. Using the reproducer in the ticket,
launch and resize the stage vertically so that the buttons at the bottom
are only partially visible.

The current behavior is as follows:
When the scrollbar is not needed, toggling to the AS_NEEDED policy
reallocates the scrollbar space for the buttons (they move up).
When the scrollbar is needed, toggling to the AS_NEEDED policy still
reallocates space, and the scrollbar takes away space from the content
node. This is wrong.

I modified the method 'computeHsbSizeHint' to

private double computeHsbSizeHint(ScrollPane sp) {
    return determineHorizontalSBVisible() ?
hsb.prefHeight(ScrollBar.USE_COMPUTED_SIZE) : 0;
}

Now the policy toggling behavior is correct both when the scrollbar is
needed and when it's not - the space is reallocated not at the expense of
the content. However, enlarging the stage horizontally while AS_NEEDED is
selected does not reallocate the space (you need to toggle the policies).
I'm guessing there's a missing call to layoutChildren during this resizing.

Does anyone have any input here?


Thanks,
Nir

[1] https://bugs.openjdk.org/browse/JDK-8199934

Reply via email to