Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1007019 // onRadioButtonChange

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5053L/28K).

// f: voidfunc(int)
svoid onRadioButtonChange(final ButtonGroup group, fO f) {
  final Var<Int> 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<Int> f) {
  onRadioButtonChange(group, (O) f);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007019
Snippet name: onRadioButtonChange
Eternal ID of this version: #1007019/8
Text MD5: 61a21567a6aaa2d97c19f1f1c57e4225
Transpilation MD5: e22e726d92fe72dbe3cdfdd5e6112ae2
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-30 17:47:47
Source code size: 480 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 575 / 639
Version history: 7 change(s)
Referenced in: [show references]