JDK-8199934: ScrollPaneSkin incorrectly lays out its scrollbars

Nir Lisker nlisker at gmail.com
Mon May 1 20:09:11 UTC 2023


If I knew what the fix was I would have. Right now I'm not sure anymore
what the correct behavior should be even.

On Mon, May 1, 2023 at 10:44 PM Andy Goryachev <andy.goryachev at oracle.com>
wrote:

> 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/7075dd5f/attachment-0001.htm>


More information about the openjfx-dev mailing list