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