Libraryless. Click here for Pure Java version (9699L/54K).
1 | static <A extends JComponent> A awtCalcContinuously(A component, Runnable runnable) { |
2 | if (runnable == null) ret component; |
3 | |
4 | new SingleThread thread; |
5 | new BoolVar visible; |
6 | var info = _threadInfo(); |
7 | Runnable theLoop = r { |
8 | _threadInheritInfo(info); |
9 | while ping (visible!) { |
10 | try { |
11 | runnable.run(); |
12 | } catch print e { |
13 | sleepSeconds(1); // error penalty |
14 | } |
15 | } |
16 | }; |
17 | |
18 | bindToComponent(component, |
19 | -> { visible.set(); thread.go(theLoop); }, |
20 | -> visible.clear()); |
21 | |
22 | ret component; |
23 | } |
Began life as a copy of #1006234
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, iveijnkanddl, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034897 |
Snippet name: | awtCalcContinuously |
Eternal ID of this version: | #1034897/8 |
Text MD5: | 9044c45cd2f0e0b7c44ab019edcfdae0 |
Transpilation MD5: | 2fcdd50a933883d754294163059cd953 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-06-27 05:29:19 |
Source code size: | 555 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 134 / 218 |
Version history: | 7 change(s) |
Referenced in: | [show references] |