Util.java Source code

Java tutorial

Introduction

Here is the source code for Util.java

Source

import java.awt.Component;
import java.awt.Container;
import java.awt.Point;

public class Util {

    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;
        }

        return null;
    }

}