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).

1  
// f: voidfunc(int)
2  
svoid onRadioButtonChange(final ButtonGroup group, fO f) {
3  
  final Var<Int> idx = new Var(selectedButtonIdx(group));
4  
  Runnable r = r {
5  
    int idx2 = selectedButtonIdx(group);
6  
    if (idx2 >= 0 && idx2 != idx.get()) {
7  
      idx.set(idx2);
8  
      pcallF(f, idx2);
9  
    }
10  
  };
11  
  for (AbstractButton b : buttonsInGroup(group))
12  
    onChange(b, r);
13  
}
14  
15  
svoid onRadioButtonChange(ButtonGroup group, IVF1<Int> f) {
16  
  onRadioButtonChange(group, (O) f);
17  
}

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: 577 / 642
Version history: 7 change(s)
Referenced in: [show references]