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

11
LINES

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

JavaX fragment (include)

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

Author comment

Began life as a copy of #1036315

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036371
Snippet name: looselyBindLiveValueToTextComponent - only grab once upon display, but save on every user interaction
Eternal ID of this version: #1036371/3
Text MD5: 0151a5ef09b650ed9941a3e157080274
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-28 17:14:54
Source code size: 292 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 118 / 133
Version history: 2 change(s)
Referenced in: [show references]