void (Object component, boolean selected, String itemname, String leafname) { boolean changed = false; for (Object item = get(component, itemname); item != null; item = getNextItem(component, item, leafname)) { if (setBoolean(item, "selected", selected, false)) { repaint(component, null, item); changed = true; } } set(component, "anchor", null); if (changed) {invoke(component, "action"); } }