int (Container container) { while(container != null) { if (container instanceof JComponent) { Integer designTimeInsets = (Integer)((JComponent) container).getClientProperty(DESIGN_TIME_INSETS); if (designTimeInsets != null) { return designTimeInsets.intValue(); } } container = container.getParent(); } return 0; }