static Area actuallyVisibleComponentArea(Component c) { ret c == null ? null : swing(func -> Area { Area area = new Area(0, 0, new Rectangle(getWidth(c), getHeight(c))); Container parent = c.getParent(); if (parent == null) ret area; for (Component peer : componentsSortedByZOrder(getChildren(parent))) { if (peer = c) break; area.subtract(peer.getBounds()); } Area parentArea = actuallyVisibleComponentArea(parent); parentArea.transform(AffineTransform.getTranslateInstance(-c.getX(), -c.getY())); area.intersect(parentArea); ret area; }); }