From the API:
GridBagLayout:
...In addition to its constraints object, the GridBagLayout also considers each component's minimum and preferred sizes in order to
determine a component's size.
In addition I'd say that GridBagLayout honors the components preferred size as long as you don't use constraints which tell the layout manager to do otherwise (like the GridBadConstraints.fill member)
From the API:
CardLayout method layoutContainer:
Each component in the parent container is reshaped to be the size of the container, minus space for surrounding insets, horizontal gaps, and vertical gaps.