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).

1  
static JComboBox looselyBindLiveValueToComboBox(IVarWithNotify<S> lv, JComboBox cb) {
2  
  onChange(cb, (ChangeTriggerable) -> lv.set(getText(cb)));
3  
  bindToComponent(cb, -> {
4  
    S value = lv!;
5  
    if (value != null)
6  
      selectItem(cb, value);
7  
    else
8  
      lv.set(getText(cb));
9  
  });
10  
  ret cb;
11  
}

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: 191 / 232
Version history: 3 change(s)
Referenced in: [show references]