int (Object component) { int i = 0; for (Object item = get(component, getComponentName(component, null)); item != null; item = get(item, ":next")) { if (getBoolean(item, "selected", false)) { return i; } i++; } return -1; }