-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: client-libs
-
None
-
behavioral
-
minimal
-
Existing behaviour of JList.getScrollableUnitIncrement is clarified to mention what value it can return
-
Java API
-
SE
Summary
Clarify JList.getScrollableUnitIncrement can return a non-negative value that is, a positive value including 0, instead of mentioning it will always return a positive number.
Problem
JList.getScrollableUnitIncrement specifies that it always returns positive number, which in certain cases is not correct, as it can return 0.
Solution
Update JList.getScrollableUnitIncrement to mention it will return a non-negative number comprising of either 0 or any positive number
Specification
javax.swing.JList
* row (for vertical scrolling) or column (for horizontal scrolling).
+ * The scrolling distance returned will be positive,
+ * unless scrolling for the specified parameters is already
+ * at its furthest extent, in which case it will return zero.
* <p>
* For horizontal scrolling, if the layout orientation is {@code VERTICAL},
* then the list's font size is returned (or {@code 1} if the font is
* {@code null}).
*
@@ -2505,12 +2508,13 @@
* @param visibleRect the view area visible within the viewport
* @param orientation {@code SwingConstants.HORIZONTAL} or
* {@code SwingConstants.VERTICAL}
* @param direction less or equal to zero to scroll up/back,
* greater than zero for down/forward
- * @return the "unit" increment for scrolling in the specified direction;
- * always positive
+ * @return the non-negative "unit" increment
+ * for scrolling in the specified direction
+ *
* @see #getScrollableBlockIncrement
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
- csr of
-
JDK-8364146 JList getScrollableUnitIncrement return 0
-
- Resolved
-