Dimension () { Component component = isMinimumSizeSet() ? null : getVisibleComponent(); if (component == null) return super.getMinimumSize(); // minimum size of a visible component plus border insets of this panel Dimension size = component.getMinimumSize(); JBInsets.addTo(size, getInsets()); return size; }