1 | static <A extends JComponent> A onClick(A c, IVF1<MouseEvent> runnable) { |
2 | ret onClick(c, (O) runnable); |
3 | } |
4 | |
5 | static <A extends JComponent> A onClick(A c, O runnable) { |
6 | if (c != null) swing { |
7 | c.addMouseListener(new MouseAdapter { |
8 | public void mouseClicked(MouseEvent e) { |
9 | callF(runnable, e); |
10 | } |
11 | }); |
12 | } |
13 | ret c; |
14 | } |
15 | |
16 | // re-interpreted for buttons |
17 | svoid onClick(JButton btn, O runnable) { |
18 | onEnter(btn, runnable); |
19 | } |
Began life as a copy of #1003586
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005614 |
Snippet name: | onClick (any mouse button) |
Eternal ID of this version: | #1005614/5 |
Text MD5: | b9923cc4448265540eccac3c8ee66539 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-04 01:28:09 |
Source code size: | 458 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 610 / 671 |
Version history: | 4 change(s) |
Referenced in: | [show references] |