RFR: 8364146: JList getScrollableUnitIncrement return 0 [v3]

Phil Race prr at openjdk.org
Fri Aug 22 22:19:54 UTC 2025


On Wed, 6 Aug 2025 07:51:00 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> It seems JList.getScrollableUnitIncrement can sometime return 0 instead of positive number which is not specified in the javadoc which can lead to confusion. Clarified javadoc as to when it can return 0.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   javadoc update

I don't think you are capturing what is going on here.
The cases here are that y=0 so you can't scroll up, because you are at the top.
You don't ordinarlly see this in the positive direction because the cell that is returned is null for out of range, and otherwise it at least points to the TOP of the last cell. 
But I'm not sure how you can actually scroll, because the returned increment would take you off the bottom of the list, 
And if the rectangle you pass in has a y that is = the height of the list, then scrolling in a positive direction also returns 0.
If it is GREATER than the height, then I get back a negative increment !

So this needs quite a bit more than the suggested words, because they aren't accurate or nearly sufficient.
I think a code fix might be needed too.
I can even get a negative scroll value from the upwards direction.
All you have to do is pass a synthesized rect to the API. 
The implementation doesn't seem to be expecting that and it should probably do something in response, but it may be too late from a compatibility point of view. 
I need you to figure this all out.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26500#issuecomment-3215821257


More information about the client-libs-dev mailing list