/** * Sets the current selected offset in the list, by default this implementation will scroll the * list to the selection if the selection is outside of the screen * * @param index the current selected offset in the list */ public void setSelectedIndex(int index) { if (index < 0) { throw new IllegalArgumentException("Selection index is negative:" + index); } getComponentAt(index).requestFocus(); model.setSelectedIndex(index); }