Returns the amount to increment when scrolling. The amount is the height of the first displayed row that isn't completely in view or, if it is totally displayed, the height of the next row in the scrolling direction. @param visibleRect the view area visible within the viewport @param orientation ei
(Rectangle visibleRect,
int orientation, int direction)
| 3458 | * @see JScrollBar#setUnitIncrement(int) |
| 3459 | */ |
| 3460 | public int getScrollableUnitIncrement(Rectangle visibleRect, |
| 3461 | int orientation, int direction) { |
| 3462 | if(orientation == SwingConstants.VERTICAL) { |
| 3463 | Rectangle rowBounds; |
| 3464 | int firstIndex = getClosestRowForLocation |
| 3465 | (0, visibleRect.y); |
| 3466 | |
| 3467 | if(firstIndex != -1) { |
| 3468 | rowBounds = getRowBounds(firstIndex); |
| 3469 | if(rowBounds.y != visibleRect.y) { |
| 3470 | if(direction < 0) { |
| 3471 | // UP |
| 3472 | return Math.max(0, (visibleRect.y - rowBounds.y)); |
| 3473 | } |
| 3474 | return (rowBounds.y + rowBounds.height - visibleRect.y); |
| 3475 | } |
| 3476 | if(direction < 0) { // UP |
| 3477 | if(firstIndex != 0) { |
| 3478 | rowBounds = getRowBounds(firstIndex - 1); |
| 3479 | return rowBounds.height; |
| 3480 | } |
| 3481 | } |
| 3482 | else { |
| 3483 | return rowBounds.height; |
| 3484 | } |
| 3485 | } |
| 3486 | return 0; |
| 3487 | } |
| 3488 | return 4; |
| 3489 | } |
| 3490 | |
| 3491 | |
| 3492 | /** |
nothing calls this directly
no test coverage detected