Dimension (int minWidth, int maxWidth) { int width = Math.max(Math.max(definitionPreferredWidth(), getMinimumSize().width), minWidth); int height = getPreferredHeightByWidth(Math.min(width, maxWidth)); return new Dimension(width, height); }