Dimension () { final Dimension preferredSize = super.getPreferredSize(); final int originalHeight = myOriginalHeightComponent.getPreferredSize().height; if (preferredSize.height > originalHeight) return preferredSize; return new Dimension(preferredSize.width, originalHeight); }