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

11
LINES

< > BotCompany Repo | #1036315 // looselyBindLiveValueToComboBox - only grab once upon display, but save on every user interaction

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

Libraryless. Click here for Pure Java version (11351L/63K).

static JComboBox looselyBindLiveValueToComboBox(IVarWithNotify<S> lv, JComboBox cb) {
  onChange(cb, (ChangeTriggerable) -> lv.set(getText(cb)));
  bindToComponent(cb, -> {
    S value = lv!;
    if (value != null)
      selectItem(cb, value);
    else
      lv.set(getText(cb));
  });
  ret cb;
}

Author comment

Began life as a copy of #1035882

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036315
Snippet name: looselyBindLiveValueToComboBox - only grab once upon display, but save on every user interaction
Eternal ID of this version: #1036315/4
Text MD5: ef8d5507a552b9a34c160ac95bb05be1
Transpilation MD5: 9c6c63ce9618982fcf7605c499c71465
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-05-05 09:05:18
Source code size: 307 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 232
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1036371 - looselyBindLiveValueToTextComponent - only grab once upon display, but save on every user interaction