Libraryless. Click here for Pure Java version (2919L/17K).
1 | static Component componentAtScreenLocationInWindow(Window window, int x, int y) { |
2 | if (window == null) null; |
3 | ret swing(func -> Component { |
4 | Point p = new(x, y); |
5 | SwingUtilities.convertPointFromScreen(p, window); |
6 | ret SwingUtilities.getDeepestComponentAt(window, p.x, p.y); |
7 | }); |
8 | } |
9 | |
10 | static Component componentAtScreenLocationInWindow(Window window, MouseEvent e) { |
11 | Point p = e.getLocationOnScreen(); |
12 | ret componentAtScreenLocationInWindow(window, p.x, p.y); |
13 | } |
Began life as a copy of #1019640
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031122 |
Snippet name: | componentAtScreenLocationInWindow |
Eternal ID of this version: | #1031122/1 |
Text MD5: | d78730bf1e42f1c8d555808c8c1b403f |
Transpilation MD5: | 8d98bcda3157563fd4c0dfcb13397618 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-07 15:51:04 |
Source code size: | 487 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 168 / 220 |
Referenced in: | [show references] |