Dimension () { // take size from the root view directly, because base implementation is resetting the root view size // if current bounds are empty (component is not added to screen) View root = getRootView(); Dimension dim = new Dimension((int)root.getPreferredSpan(View.X_AXIS), (int)root.getPreferredSpan(View.Y_AXIS)); JBInsets.addTo(dim, getInsets()); return dim; }