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

9
LINES

< > BotCompany Repo | #1034283 // enableComponentAccordingToVar

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

Libraryless. Click here for Pure Java version (5698L/31K).

static <A extends JComponent> A enableComponentAccordingToVar(BoolVarWithNotify var, A c) {
  if (var != null) {
    Runnable update = -> setEnabled(c, var!);
    bindToComponent(c,
      -> var.onChangeAndNow(update),
      -> var.removeChangeListener(update));
  }    
  ret c;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034283
Snippet name: enableComponentAccordingToVar
Eternal ID of this version: #1034283/3
Text MD5: 07051f6bb249da1bf9f390a7df9bca67
Transpilation MD5: e9fd08d14c477f197b38f7505c698e69
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-31 21:06:18
Source code size: 289 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 119 / 185
Version history: 2 change(s)
Referenced in: [show references]