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

13
LINES

< > BotCompany Repo | #1016619 // bindComboBoxToLiveValue

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

Libraryless. Click here for Pure Java version (10167L/56K).

static new ThreadLocal<Bool> bindComboBoxToLiveValue_debug;

static <A extends JComboBox> A bindComboBoxToLiveValue(final A cb, IVarWithNotify<S> lv) {
  bool debug = isTrue(bindComboBoxToLiveValue_debug!);
  bindLiveValueListenerToComponent(cb, lv, r { selectItem(cb, lv!) });
  onChange(cb, r {
    S s = getText(cb); // also works on editable combo boxes
    if (debug)
      print("ComboBox: " + s);
    lv.set(s);
  });
  ret cb;
}

Author comment

Began life as a copy of #1015821

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: #1016619
Snippet name: bindComboBoxToLiveValue
Eternal ID of this version: #1016619/5
Text MD5: 56a00772fb2e147a6e55d7cf97365d3f
Transpilation MD5: 42438f4a4d3a9923437b961e4a536e6b
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-07 11:04:46
Source code size: 448 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 322 / 392
Version history: 4 change(s)
Referenced in: [show references]