static Rect boundsInParent(Component c, Class parentType) { ret boundsInParent(c, parentOfType(parentType)); } static Rect boundsInParent(final Component _c, final Component parent) { if (_c == null) null; ret swing(func -> Rect { Rect r = toRect(_c.getBounds()); Component c = _c; while true { c = c.getParent(); if (c == null) null; if (c == parent) ret r; r = translateRect(r, c.getX(), c.getY()); } }); }