boolean (int indexToSelect) { if (getSelectedIndex() != indexToSelect && getElementCount() > indexToSelect && getModel().getElementAt(indexToSelect) != null) { setSelectedIndex(indexToSelect); return true; } return false; }