protected void addButtons ( int start , int count ) { Object selobj = _model . getSelectedItem ( ) ; for ( int i = start ; i < count ; i ++ ) { Object elem = _model . getElementAt ( i ) ; if ( selobj == elem ) { _selectedIndex = i ; } JLabel ibut = null ; if ( elem instanceof Image ) { ibut = new JLabel ( new ImageIcon ( ( Image ) elem ) ) ; } else { ibut = new JLabel ( elem . toString ( ) ) ; } ibut . putClientProperty ( "element" , elem ) ; ibut . addMouseListener ( this ) ; ibut . setBorder ( ( _selectedIndex == i ) ? SELECTED_BORDER : DESELECTED_BORDER ) ; add ( ibut , i ) ; } SwingUtil . refresh ( this ) ; }
Adds buttons for the specified range of model elements .