List of usage examples for java.awt Component getComponentAt
public Component getComponentAt(int x, int y)
From source file:Main.java
/** * Returns top component inside the specified container component at the * specified point./* w w w .j a v a2s . co m*/ * * @param component * container component to process * @param x * X coordinate * @param y * Y coordinate * @return top component inside the specified container component at the * specified point */ public static Component getTopComponentAt(final Component component, final int x, final int y) { final Component child = component.getComponentAt(x, y); if (child == component || !(child instanceof Container)) { return component; } else { final Rectangle b = child.getBounds(); return getTopComponentAt(child, x - b.x, y - b.y); } }