question: public void delItems ( int s , int e ) { boolean hsbWasVisible = hsbVis ; boolean vsbWasVisible = vsbVis ; int oldLastDisplayed = lastItemDisplayed ( ) ; if ( log . isLoggable ( PlatformLogger . Level . FINE ) ) { log . fine ( "Deleting from " + s + " to " + e ) ; } if ( log . isLoggable ( PlatformLogger . Level . FINEST ) ) { log . finest ( "Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow ( ) + ", size " + items . size ( ) ) ; } if ( items . size ( ) == 0 ) { return ; } if ( s > e ) { int tmp = s ; s = e ; e = tmp ; } if ( s < 0 ) { s = 0 ; } if ( e >= items . size ( ) ) { e = items . size ( ) - 1 ; } boolean repaintNeeded = ( s >= getFirstVisibleItem ( ) && s <= getLastVisibleItem ( ) ) ; for ( int i = s ; i <= e ; i ++ ) { items . removeElementAt ( s ) ; int j = posInSel ( i ) ; if ( j != - 1 ) { int newsel [ ] = new int [ selected . length - 1 ] ; System . arraycopy ( selected , 0 , newsel , 0 , j ) ; System . arraycopy ( selected , j + 1 , newsel , j , selected . length - ( j + 1 ) ) ; selected = newsel ; } } int diff = ( e - s ) + 1 ; for ( int i = 0 ; i < selected . length ; i ++ ) { if ( selected [ i ] > e ) { selected [ i ] -= diff ; } } int options = PAINT_VSCROLL ; if ( getFocusIndex ( ) > e ) { setFocusIndex ( getFocusIndex ( ) - ( e - s + 1 ) ) ; options |= PAINT_FOCUS ; } else if ( getFocusIndex ( ) >= s && getFocusIndex ( ) <= e ) { int focusBound = ( items . size ( ) > 0 ) ? 0 : - 1 ; setFocusIndex ( Math . max ( s - 1 , focusBound ) ) ; options |= PAINT_FOCUS ; } if ( log . isLoggable ( PlatformLogger . Level . FINEST ) ) { log . finest ( "Multiple selections: " + multipleSelections ) ; } if ( vsb . getValue ( ) >= s ) { if ( vsb . getValue ( ) <= e ) { vsb . setValue ( e + 1 - diff ) ; } else { vsb . setValue ( vsb . getValue ( ) - diff ) ; } } int oldMaxLength = maxLength ; maxLength = maxLength ( ) ; if ( maxLength != oldMaxLength ) { options |= PAINT_HSCROLL ; } layout ( ) ; repaintNeeded |= ( vsbWasVisible ^ vsbVis ) || ( hsbWasVisible ^ hsbVis ) ; if ( repaintNeeded ) { options |= PAINT_ALL ; } repaint ( s , oldLastDisplayed , options ) ; }
target:  delete items starting with s (start position) to e (end position) including s and e if s < 0 then s = 0 if e >= items.size() then e = items.size() - 1