protected void updateSelection ( int selidx ) { // do nothing if this element is already selected if ( selidx == _selectedIndex ) { return ; } // unhighlight the old component if ( _selectedIndex != - 1 ) { JLabel but = ( JLabel ) getComponent ( _selectedIndex ) ; but . setBorder ( DESELECTED_BORDER ) ; } // save the new selection _selectedIndex = selidx ; // if the selection is valid, highlight the new component if ( _selectedIndex != - 1 ) { JLabel but = ( JLabel ) getComponent ( _selectedIndex ) ; but . setBorder ( SELECTED_BORDER ) ; } // fire an action performed to let listeners know about our // changed selection fireActionPerformed ( ) ; repaint ( ) ; }
Sets the selection to the specified index and updates the buttons to reflect the change . This does not update the model .