Object body = ReflectionUtils.invokeMethod(getObject(), "getBody()");
Rectangle bodyBounds = getAbsoluteBounds(body);
setClientAreaInsets(new Insets(bodyBounds.y - panelBounds.y,
bodyBounds.x - panelBounds.x,
panelBounds.bottom() - bodyBounds.bottom(),
panelBounds.right() - bodyBounds.right()));
}
}
private static Rectangle getAbsoluteBounds(Object boxObject) throws Exception {
Object box = ReflectionUtils.invokeMethod(boxObject, "getBox()");