RFR: 8364146: JList getScrollableUnitIncrement return 0

Prasanta Sadhukhan psadhukhan at openjdk.org
Sun Aug 3 06:26:03 UTC 2025


On Fri, 1 Aug 2025 19:53:13 GMT, Phil Race <prr at openjdk.org> wrote:

> Isn't this just a bug ? I get zero from the test whenever "-1" is the direction - meaning scroll up - even if I use something like
> 
> https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/JList.html#getScrollableUnitIncrement(java.awt.Rectangle,int,int)

If the `visibleRect` Rectangle points to the 1st row or row 0 and we are scrolling up i.e -1 direction there is no more space to scroll up so `getScrollableUnitIncrement` returns 0.
If we modify the testcase to have `Rectangle cell = list.getCellBounds(data.length-1, data.length-1);` instead of `list.getCellBounds(0, 0);`
to point to last cell, it returns positive number for -1 direction too

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

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


More information about the client-libs-dev mailing list