1 | // f : voidfunc(Pt) - point can be null, then mouse has exited |
2 | static <A extends JComponent> A callFunctionOnMouseMove(final A c, final O f) {
|
3 | if (c != null && f != null) swing {
|
4 | MouseAdapter ma = new MouseAdapter {
|
5 | public void mouseMoved(MouseEvent e) { pcallF(f, is.pointFromEvent(e)); }
|
6 | public void mouseEntered(MouseEvent e) { pcallF(f, is.pointFromEvent(e)); }
|
7 | public void mouseExited(MouseEvent e) { pcallF(f, (Pt) null); }
|
8 | }; |
9 | c.addMouseMotionListener(ma); |
10 | c.addMouseListener(ma); |
11 | } |
12 | ret c; |
13 | } |
Began life as a copy of #1005948
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1019902 |
| Snippet name: | callFunctionOnMouseMove (dev.) |
| Eternal ID of this version: | #1019902/2 |
| Text MD5: | 3e26bc0b52f644761e9f4a9a6ad6ef32 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-08-18 14:47:44 |
| Source code size: | 549 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 564 / 582 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |