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

32
LINES

< > BotCompany Repo | #1005426 - jCheckBox - make JCheckBox

JavaX fragment (include)

1  
static JCheckBox jCheckBox() {
2  
  ret swingNu(JCheckBox);
3  
}
4  
5  
static JCheckBox jCheckBox(bool checked) {
6  
  ret swingNu(JCheckBox, "", checked);
7  
}
8  
9  
static JCheckBox jCheckBox(S text, bool checked) {
10  
  ret swingNu(JCheckBox, text, checked);
11  
}
12  
13  
static JCheckBox jCheckBox(S text) {
14  
  ret swingNu(JCheckBox, text);
15  
}
16  
  
17  
static JCheckBox jCheckBox(S text, bool checked, fO onChange) {
18  
  JCheckBox cb = jCheckBox(checked, onChange);
19  
  cb.setText(text);
20  
  ret cb;
21  
}
22  
  
23  
// onChange can be a Runnable or a voidfunc(bool)
24  
static JCheckBox jCheckBox(bool checked, fO onChange) {
25  
  final JCheckBox cb = jCheckBox(checked);
26  
  cb.addChangeListener(new ChangeListener {
27  
    public void stateChanged(ChangeEvent e) {
28  
      pcallF(onChange, cb.isSelected());
29  
    }
30  
  });
31  
  ret cb;
32  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005426
Snippet name: jCheckBox - make JCheckBox
Eternal ID of this version: #1005426/2
Text MD5: f46a271af0d3f922c01b9b5a4db50a78
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-16 18:18:56
Source code size: 794 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 479 / 484
Version history: 1 change(s)
Referenced in: [show references]