List of usage examples for java.awt Component contains
public boolean contains(Point p)
From source file:Main.java
private void myPaint(Component comp, Graphics g) { int x = comp.getX(); int y = comp.getY(); g.translate(x, y);//from w w w . j a v a2 s . c om cursor.translate(-x, -y); if (comp.contains(cursor)) { String cls_name = comp.getClass().getName(); g.setColor(Color.black); g.drawString(cls_name, 0, 10); } if (comp instanceof Container) { Container cont = (Container) comp; for (int i = 0; i < cont.getComponentCount(); i++) { Component child = cont.getComponent(i); myPaint(child, g); } } cursor.translate(x, y); g.translate(-x, -y); }
From source file:edworld.pdfreader4humans.PDFReader.java
protected Component findContainer(Component component, List<? extends Component> containers) { Component container = null;/*from ww w. ja va 2s . co m*/ float area = Float.POSITIVE_INFINITY; for (Component possibleContainer : containers) if (possibleContainer.contains(component) && possibleContainer.getArea() < area) { container = possibleContainer; area = possibleContainer.getArea(); } return container; }