/** * Selects the specified object from the list and clear all other selections. * * @param anObject the object to select * @param shouldScroll true if the list should scroll to display the selected object, if one exists; otherwise * false */ public void setCheckBoxListSelectedValue(Object anObject, boolean shouldScroll) { if (anObject == null) setSelectedIndex(-1); else { int i, c; ListModel model = getModel(); for (i = 0, c = model.getSize(); i < c; i++) if (anObject.equals(model.getElementAt(i))) { setCheckBoxListSelectedIndex(i); if (shouldScroll) ensureIndexIsVisible(i); repaint(); /** FIX-ME setSelectedIndex does not redraw all the time with the basic l&f**/ return; } setCheckBoxListSelectedIndex(-1); } repaint(); /** FIX-ME setSelectedIndex does not redraw all the time with the basic l&f**/ }