question: void scrollVertical ( int y ) { if ( log . isLoggable ( PlatformLogger . Level . FINE ) ) { log . fine ( "Scrolling vertically by " + y ) ; } int itemsInWin = itemsInWindow ( ) ; int h = getItemHeight ( ) ; int pixelsToScroll = y * h ; if ( vsb . getValue ( ) < - y ) { y = - vsb . getValue ( ) ; } vsb . setValue ( vsb . getValue ( ) + y ) ; Rectangle source = null ; Point distance = null ; int firstItem = 0 , lastItem = 0 ; int options = PAINT_HIDEFOCUS | PAINT_ITEMS | PAINT_VSCROLL | PAINT_FOCUS ; if ( y > 0 ) { if ( y < itemsInWin ) { source = new Rectangle ( MARGIN , MARGIN + pixelsToScroll , width - SCROLLBAR_AREA , h * ( itemsInWin - y - 1 ) - 1 ) ; distance = new Point ( 0 , - pixelsToScroll ) ; options |= COPY_AREA ; } firstItem = vsb . getValue ( ) + itemsInWin - y - 1 ; lastItem = vsb . getValue ( ) + itemsInWin - 1 ; } else if ( y < 0 ) { if ( y + itemsInWindow ( ) > 0 ) { source = new Rectangle ( MARGIN , MARGIN , width - SCROLLBAR_AREA , h * ( itemsInWin + y ) ) ; distance = new Point ( 0 , - pixelsToScroll ) ; options |= COPY_AREA ; } firstItem = vsb . getValue ( ) ; lastItem = Math . min ( getLastVisibleItem ( ) , vsb . getValue ( ) + - y ) ; } repaint ( firstItem , lastItem , options , source , distance ) ; }
target:  scrollVertical y is the number of items to scroll