Example #1
0
 /**
  * Deselects the specified object from the list.
  *
  * @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 removeCheckBoxListSelectedValue(Object anObject, boolean shouldScroll) {
   if (anObject != null) {
     int i, c;
     ListModel model = getModel();
     for (i = 0, c = model.getSize(); i < c; i++)
       if (anObject.equals(model.getElementAt(i))) {
         removeCheckBoxListSelectedIndex(i);
         if (shouldScroll) ensureIndexIsVisible(i);
         repaint();
         /** FIX-ME setSelectedIndex does not redraw all the time with the basic l&f* */
         return;
       }
   }
 }
Example #2
0
 /**
  * Deselects the specified objects from the list and keep all previous selections.
  *
  * @param objects the objects to be selected
  */
 public void removeCheckBoxListSelectedValues(Object[] objects) {
   if (objects != null) {
     Map<Object, String> map = new HashMap<Object, String>();
     for (Object o : objects) {
       map.put(o, "");
     }
     int i, c;
     ListModel model = getModel();
     boolean changed = false;
     for (i = 0, c = model.getSize(); i < c; i++)
       if (map.get(model.getElementAt(i)) != null) {
         removeCheckBoxListSelectedIndex(i);
         changed = true;
       }
     if (changed) {
       repaint();
     }
     map.clear();
   }
 }