// f: voidfunc(int) svoid onRadioButtonChange(final ButtonGroup group, fO f) { final Var idx = new Var(selectedButtonIdx(group)); Runnable r = r { int idx2 = selectedButtonIdx(group); if (idx2 >= 0 && idx2 != idx.get()) { idx.set(idx2); pcallF(f, idx2); } }; for (AbstractButton b : buttonsInGroup(group)) onChange(b, r); } svoid onRadioButtonChange(ButtonGroup group, IVF1 f) { onRadioButtonChange(group, (O) f); }