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

15
LINES

< > BotCompany Repo | #1035934 // looselyBindLiveValueToCheckBox

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

Libraryless. Click here for Pure Java version (11267L/62K).

static <A extends JCheckBox> A looselyBindLiveValueToCheckBox(A cb, IVarWithNotify<Bool> lv) {
  onChange(cb, (Runnable) () -> lv.set(isChecked(cb)));
  bindToComponent(cb, -> {
    var value = lv!;
    if (value != null)
      setChecked(cb, value);
    else
      lv.set(isChecked(cb));
  });
  ret cb;
}

static <A extends JCheckBox> A looselyBindLiveValueToCheckBox(IVarWithNotify<Bool> lv, A cb) {
  ret looselyBindLiveValueToCheckBox(cb, lv);
}

Author comment

Began life as a copy of #1017125

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035934
Snippet name: looselyBindLiveValueToCheckBox
Eternal ID of this version: #1035934/7
Text MD5: a6f775625a2c95d9cb602931d1d95e81
Transpilation MD5: 2d769ba59f65a21d344fc546cb02d51e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-05-13 02:16:35
Source code size: 464 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 78 / 132
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)