List of usage examples for java.awt Container getBounds
public Rectangle getBounds(Rectangle rv)
From source file:Main.java
/** * Finds the real bounds of the component relative to the root Window * * @param container The container to find the bounds for. * @param rect A Rectangle to store the bounds in. This same object is * returned./*from w w w . j a v a 2 s . c o m*/ * @return The real bounds of the container. */ public static Rectangle getRealBounds(Container container, Rectangle rect) { container.getBounds(rect); for (Container c = container.getParent(); !(c instanceof Window); c = c.getParent()) { Point p = c.getLocation(); rect.x += p.x; rect.y += p.y; } return rect; }