Libraryless. Click here for Pure Java version (7982L/45K).
// action can be Runnable or a function name static JButton jThreadedButton(S text, O action) { ret swing(func -> JButton { S text2 = dropPrefix("[disabled] ", text); JButton btn = basicJButton(text2); if (l(text2) < l(text)) btn.setEnabled(false); btn.setToolTipText(btn.getText()); if (action != null) btn.addActionListener(actionListenerInNewThread(action, btn)); ret btn; }); } static JButton jThreadedButton(S text, Runnable action) { ret jThreadedButton(text, (O) action); }
Began life as a copy of #1003297
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022588 |
Snippet name: | jThreadedButton - make JButton running in new thread & holding button instance |
Eternal ID of this version: | #1022588/3 |
Text MD5: | fd8a9bbb9b5ca4531f41be9c401682e0 |
Transpilation MD5: | 3a40e720bc4d2a253502fc93438cd095 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-28 15:34:26 |
Source code size: | 532 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 359 / 459 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |