void selectItem(int index){
  currentIndex=index;
  if (isSelected(index)) {
    return;
  }
  if (!multipleSelections) {
    if (selected.length == 0) {
      selected=new int[1];
      selected[0]=index;
    }
 else {
      int oldSel=selected[0];
      selected[0]=index;
      if (!isItemHidden(oldSel)) {
        repaint(oldSel,oldSel,PAINT_ITEMS);
      }
    }
  }
 else {
    int newsel[]=new int[selected.length + 1];
    int i=0;
    while (i < selected.length && index > selected[i]) {
      newsel[i]=selected[i];
      i++;
    }
    newsel[i]=index;
    System.arraycopy(selected,i,newsel,i + 1,selected.length - i);
    selected=newsel;
  }
  if (!isItemHidden(index)) {
    repaint(index,index,PAINT_ITEMS);
  }
}

void selectItem ( int index ) { currentIndex = index ; if ( isSelected ( index ) ) { return ; } if ( ! multipleSelections ) { if ( selected . length == 0 ) { selected = new int [ 1 ] ; selected [ 0 ] = index ; } else { int oldSel = selected [ 0 ] ; selected [ 0 ] = index ; if ( ! isItemHidden ( oldSel ) ) { repaint ( oldSel , oldSel , PAINT_ITEMS ) ; } } } else { int newsel [ ] = new int [ selected . length + 1 ] ; int i = 0 ; while ( i < selected . length && index > selected [ i ] ) { newsel [ i ] = selected [ i ] ; i ++ ; } newsel [ i ] = index ; System . arraycopy ( selected , i , newsel , i + 1 , selected . length - i ) ; selected = newsel ; } if ( ! isItemHidden ( index ) ) { repaint ( index , index , PAINT_ITEMS ) ; } }
select the index redraw the list to the screen
