sbool newButton_autoToolTip = true; sbool newButton_autoToolTip() { ret newButton_autoToolTip; } // action can be Runnable or a function name static JButton newButton(fS text, final O action) { ret swing(func -> JButton { S text2 = dropPrefix("[disabled] ", text); JButton btn = basicJButton(text2); if (l(text2) < l(text)) btn.setEnabled(false); if (newButton_autoToolTip) { btn.setToolTipText(btn.getText()); //onChangeAndNow(btn, r { btn.setToolTipText(btn.getText()) }); } // submitButtonOnEnter(btn); // test this first if (action != null) btn.addActionListener(actionListener(action, btn)); ret btn; }); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003297 |
Snippet name: | newButton - make JButton with runnable/function name |
Eternal ID of this version: | #1003297/14 |
Text MD5: | 0cc38e9b252967010cab6ac4caf437ad |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-10-07 15:30:12 |
Source code size: | 686 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 677 / 803 |
Version history: | 13 change(s) |
Referenced in: | [show references] |