int (final DimensionInfo info, final int componentIndex) { final int s; if ((info.getSizePolicy(componentIndex) & GridConstraints.SIZEPOLICY_CAN_SHRINK) != 0) { s = info.getMinimumWidth(componentIndex); } else { // it might be possible that minSize > prefSize (for example, only min is set in constraints to 100 and // JComponent's preferred size returned is 20) s = Math.max(info.getMinimumWidth(componentIndex), info.getPreferredWidth(componentIndex)); } return s; }