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)

static JCheckBox jCheckBox() {
  ret swingNu(JCheckBox);
}

static JCheckBox jCheckBox(bool checked) {
  ret swingNu(JCheckBox, "", checked);
}

static JCheckBox jCheckBox(S text, bool checked) {
  ret swingNu(JCheckBox, text, checked);
}

static JCheckBox jCheckBox(S text) {
  ret swingNu(JCheckBox, text);
}
  
static JCheckBox jCheckBox(S text, bool checked, fO onChange) {
  JCheckBox cb = jCheckBox(checked, onChange);
  cb.setText(text);
  ret cb;
}
  
// onChange can be a Runnable or a voidfunc(bool)
static JCheckBox jCheckBox(bool checked, fO onChange) {
  final JCheckBox cb = jCheckBox(checked);
  cb.addChangeListener(new ChangeListener {
    public void stateChanged(ChangeEvent e) {
      pcallF(onChange, cb.isSelected());
    }
  });
  ret cb;
}

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