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

14
LINES

< > BotCompany Repo | #1019640 // componentAtScreenLocation

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

Libraryless. Click here for Pure Java version (2941L/17K).

1  
static Component componentAtScreenLocation(final int x, final int y) {
2  
  ret swing(func -> Component {
3  
    Point p = new(x, y);
4  
    Window window = locationToWindow(p);
5  
    if (window == null) null;
6  
    SwingUtilities.convertPointFromScreen(p, window);
7  
    ret SwingUtilities.getDeepestComponentAt(window, p.x, p.y);
8  
  });
9  
}
10  
11  
static Component componentAtScreenLocation(MouseEvent e) {
12  
  Point p = e.getLocationOnScreen();
13  
  ret componentAtScreenLocation(p.x, p.y);
14  
}

Author comment

Began life as a copy of #1008160

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019640
Snippet name: componentAtScreenLocation
Eternal ID of this version: #1019640/7
Text MD5: c1c7a1ffd5fd457dd89ba88fd31bfaeb
Transpilation MD5: 5c5c07c31f2a4d89a5b2f201c63c0aa9
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:48:32
Source code size: 481 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 323 / 430
Version history: 6 change(s)
Referenced in: [show references]