Dimension (final int componentIndex) { Dimension size = myLayoutState.myPreferredSizes[componentIndex]; if (size == null) { size = Util.getPreferredSize(myLayoutState.getComponent(componentIndex), myLayoutState.getConstraints(componentIndex), true); myLayoutState.myPreferredSizes[componentIndex] = size; } return size; }