public synchronized T setSelectedIndex(int index) {
        selectedIndex = index;
        if(selectedIndex < 0) {
            selectedIndex = 0;
        }
        if(selectedIndex > items.size() - 1) {
            selectedIndex = items.size() - 1;
        }
        invalidate();
        return self();
    }
public synchronized T setSelectedIndex ( int index ) { selectedIndex = index ; if ( selectedIndex < 0 ) { selectedIndex = 0 ; } if ( selectedIndex > items . size ( ) - 1 ) { selectedIndex = items . size ( ) - 1 ; } invalidate ( ) ; return self ( ) ; }
Sets which item in the list box that is currently selected. Please note that in this context, selected simply
means it is the item that currently has input focus. This is not to be confused with list box implementations
such as {@code CheckBoxList} where individual items have a certain checked/unchecked state.
@param index Index of the item that should be currently selected
@return Itself