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

38
LINES

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

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

Libraryless. Click here for Pure Java version (5747L/32K).

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, O onChange) {
  JCheckBox cb = jCheckBox(text, checked);
  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;
}

static JCheckBox jCheckBox(bool checked, S text, IVF1<Bool> onChangeAndNow) {
  var cb = jCheckBox(text, checked);
  onChangeAndNow(cb, r { onChangeAndNow.get(isChecked(cb)); });
  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/9
Text MD5: cf1dfc2160a0ea88b4b50d01cc83ec3c
Transpilation MD5: e3eb753b58a04c812d5f185eba8d1687
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-06 01:22:07
Source code size: 987 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 714 / 825
Version history: 8 change(s)
Referenced in: [show references]