Libraryless. Click here for Pure Java version (6072L/33K).
1 | static <A extends JLabel> A bindJLabelToVar(A label, IGetterWithNotify var) { |
2 | bindListenerToComponent(label, var, -> { |
3 | try { |
4 | setText(label, strOrNull(var!)); |
5 | } catch print e { |
6 | setText(label, "Error"); |
7 | } |
8 | }); |
9 | ret label; |
10 | } |
Began life as a copy of #1016975
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034437 |
Snippet name: | bindJLabelToVar |
Eternal ID of this version: | #1034437/4 |
Text MD5: | de9a0da9ab4310a69a162850e8dcff95 |
Transpilation MD5: | 07b2a55a6e17e320dcd9a6bd4a2ca62f |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-24 15:10:03 |
Source code size: | 258 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 149 / 234 |
Version history: | 3 change(s) |
Referenced in: | [show references] |