JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars

Andy Goryachev andy.goryachev at oracle.com
Mon May 1 19:44:12 UTC 2023


Nir, would you like to submit a pull request?

Thank you
-andy

From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Nir Lisker <nlisker at gmail.com>
Date: Sunday, April 30, 2023 at 10:04
To: openjfx-dev <openjfx-dev at openjdk.org>
Subject: JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230501/99dc941a/attachment.htm>


More information about the openjfx-dev mailing list