boolean () { if (myList.getSelectedIndex() < 0 || myList.getSelectedIndex() >= myList.getModel().getSize()) { if (myList.getModel().getSize() >= 0) { myList.setSelectedIndex(0); return false; } } return true; }