void (Object component, Object lead, Object row, String itemname, String leafname) { Object anchor = get(component, "anchor"); if (anchor == null) { set(component, "anchor", anchor = lead); } char select = 'n'; boolean changed = false; for (Object item = get(component, itemname); // anchor - row item != null; item = getNextItem(component, item, leafname)) { if (item == anchor) select = (select == 'n') ? 'y' : 'r'; if (item == row) select = (select == 'n') ? 'y' : 'r'; if (setBoolean(item, "selected", (select != 'n'), false)) { repaint(component, null, item); changed = true; } if (select == 'r') select = 'n'; } if (changed) { invoke(component, "action"); } }