void (final Component component, final GridConstraints constraints, final Dimension size) { final Dimension minimumSize = getMinimumSize(component, constraints, false); final Dimension maximumSize = getMaximumSize(constraints, false); size.width = Math.max(size.width, minimumSize.width); size.height = Math.max(size.height, minimumSize.height); size.width = Math.min(size.width, maximumSize.width); size.height = Math.min(size.height, maximumSize.height); }