Example usage for java.awt Component contains

List of usage examples for java.awt Component contains

Introduction

In this page you can find the example usage for java.awt Component contains.

Prototype

public boolean contains(int x, int y) 

Source Link

Document

Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.

Usage

From source file:Util.java

public static final Component getVisibleChildAt(Container container, Point p) {
    for (int i = 0; i < container.getComponentCount(); i++) {
        Component c = container.getComponent(i);
        if (c.isVisible() && c.contains(p.x - c.getX(), p.y - c.getY()))
            return c;
    }//from ww  w.  j av  a2  s .  c o  m

    return null;
}