MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getScrollableUnitIncrement

Method getScrollableUnitIncrement

unused/javax/swing/JTree.java:3460–3489  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 /**

Callers

nothing calls this directly

Calls 3

getRowBoundsMethod · 0.95
maxMethod · 0.80

Tested by

no test coverage detected