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).

static Component componentAtScreenLocation(final int x, final int y) {
  ret swing(func -> Component {
    Point p = new(x, y);
    Window window = locationToWindow(p);
    if (window == null) null;
    SwingUtilities.convertPointFromScreen(p, window);
    ret SwingUtilities.getDeepestComponentAt(window, p.x, p.y);
  });
}

static Component componentAtScreenLocation(MouseEvent e) {
  Point p = e.getLocationOnScreen();
  ret componentAtScreenLocation(p.x, p.y);
}

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: 324 / 432
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1031122 - componentAtScreenLocationInWindow