Libraryless. Click here for Pure Java version (5698L/31K).
1 | static <A extends JComponent> A enableComponentAccordingToVar(BoolVarWithNotify var, A c) {
|
2 | if (var != null) {
|
3 | Runnable update = -> setEnabled(c, var!); |
4 | bindToComponent(c, |
5 | -> var.onChangeAndNow(update), |
6 | -> var.removeChangeListener(update)); |
7 | } |
8 | ret c; |
9 | } |
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: | 330 / 437 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |