boolean (Object component, boolean box) { String group = getString(component, "group", null); if (group != null) { if (getBoolean(component, "selected", false)) { return false; } for (Object comp = get(getParent(component), box ? "component" : "menu"); comp != null; comp = get(comp, ":next")) { if (comp == component) { setBoolean(component, "selected", true); } else if (group.equals(get(comp, "group")) && getBoolean(comp, "selected", false)) { setBoolean(comp, "selected", false); if (box) { repaint(comp); } //checkbox only } } } else { setBoolean(component, "selected", !getBoolean(component, "selected", false), false); } invoke(component, "action"); return true; }