1 | static int mouseClick_delay = 100; // how long to keep pressed |
2 | |
3 | static void mouseClick(Rect r) { |
4 | mouseClick(centerOfRect(r)); |
5 | } |
6 | |
7 | static void mouseClick(Pt p) { |
8 | mouseClick(p.x, p.y); |
9 | } |
10 | |
11 | static void mouseClick(int x, int y) ctex { |
12 | final new Robot robot; |
13 | robot.mouseMove(x, y); |
14 | mouseClick(); |
15 | } |
16 | |
17 | static void mouseClick() ctex { |
18 | final new Robot robot; |
19 | final int button = InputEvent.BUTTON1_DOWN_MASK; |
20 | robot.mousePress(button); |
21 | sleep(mouseClick_delay); |
22 | robot.mouseRelease(button); |
23 | } |
Began life as a copy of #1005571
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005793 |
Snippet name: | mouseClick - simulate mouse click; TODO: use mouseMover() |
Eternal ID of this version: | #1005793/3 |
Text MD5: | 04da43ddb94c11a7c2341d8d3764f70e |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-01 01:17:24 |
Source code size: | 518 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 508 / 519 |
Version history: | 2 change(s) |
Referenced in: | [show references] |