Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

32
LINES

< > BotCompany Repo | #1006660 // onLeftClick

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (5211L) is out of date.

1  
// runnable can take an argument (Pt)
2  
static <A extends JComponent> A onLeftClick(final A c, fO runnable) {
3  
  swing {
4  
    c.addMouseListener(leftClickMouseAdapter(runnable));
5  
  }
6  
  ret c;
7  
}
8  
9  
// runnable takes no args
10  
static TrayIcon onLeftClick(final TrayIcon c, final O runnable) {
11  
  swing {
12  
    c.addMouseListener(leftClickMouseAdapter_noPt(runnable));
13  
  }
14  
  ret c;
15  
}
16  
17  
18  
static <A extends JComponent> A onLeftClick(fO runnable, A c) {
19  
  ret onLeftClick(c, runnable);
20  
}
21  
22  
static <A extends JComponent> A onLeftClick(Runnable runnable, A c) {
23  
  ret onLeftClick((O) runnable, c);
24  
}
25  
26  
static <A extends JComponent> A onLeftClick(A c, Runnable r) {
27  
  ret onLeftClick(r, c);
28  
}
29  
30  
static <A extends JComponent> A onLeftClick(A c, IVF1<Pt> r) {
31  
  ret onLeftClick(c, (O) r);
32  
}

Author comment

Began life as a copy of #1005614

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006660
Snippet name: onLeftClick
Eternal ID of this version: #1006660/16
Text MD5: 7cfe1ea7babcf8fcc1095a9b4d972836
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-06 00:26:55
Source code size: 795 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 630 / 687
Version history: 15 change(s)
Referenced in: [show references]