public void setValue ( Object newValue ) { int [ ] newSelection = ( int [ ] ) newValue ; if ( hasChanged ( currentSelection , newSelection ) ) { int [ ] oldValue = currentSelection ; currentSelection = newSelection ; fireValueChange ( oldValue , currentSelection ) ; if ( ! skipSelectionModelUpdate ) { // Don't want notifications while we do this model . removeListSelectionListener ( this ) ; // Install the selection on the adapted model model . clearSelection ( ) ; int i = 0 ; int len = newSelection . length ; while ( i < len ) { int start = newSelection [ i ] ; while ( i < len - 1 && newSelection [ i ] == newSelection [ i + 1 ] - 1 ) { i ++ ; } int end = newSelection [ i ] ; model . addSelectionInterval ( start , end ) ; i ++ ; } // Reinstall listener model . addListSelectionListener ( this ) ; } } }
Set the selection value .