--- old/src/java.desktop/share/classes/java/awt/Component.java 2016-04-29 19:12:52.947838160 +0530 +++ new/src/java.desktop/share/classes/java/awt/Component.java 2016-04-29 19:12:52.739734159 +0530 @@ -2702,10 +2702,11 @@ } /** - * Sets the minimum size of this component to a constant - * value. Subsequent calls to {@code getMinimumSize} will always - * return this value. Setting the minimum size to {@code null} - * restores the default behavior. + * Sets the minimum size of this component to a constant value. + * If the value is greater than maximum size, then maximum size is also + * set to this value. Subsequent calls to {@code getMinimumSize} will + * always return this value. + * Setting the minimum size to {@code null} restores the default behavior. * * @param minimumSize the new minimum size of this component * @see #getMinimumSize @@ -2719,13 +2720,24 @@ // size. if (minSizeSet) { old = this.minSize; - } - else { + } else { old = null; } this.minSize = minimumSize; minSizeSet = (minimumSize != null); firePropertyChange("minimumSize", old, minimumSize); + if (isMaximumSizeSet() && minimumSize != null) { + Dimension lMaxSize = getMaximumSize(); + if (lMaxSize.width < minimumSize.width) { + lMaxSize.width = minimumSize.width; + } + if ( lMaxSize.height < minimumSize.height) { + lMaxSize.height = minimumSize.height; + } + if (!maxSize.equals(lMaxSize)) { + setMaximumSize(lMaxSize); + } + } } /** @@ -2775,10 +2787,11 @@ } /** - * Sets the maximum size of this component to a constant - * value. Subsequent calls to {@code getMaximumSize} will always - * return this value. Setting the maximum size to {@code null} - * restores the default behavior. + * Sets the maximum size of this component to a constant value. + * If the value is smaller than minimum size, then maximum size is + * set to minimum size. Subsequent calls to {@code getMaximumSize} + * will return this or corrected value. + * Setting the maximum size to {@code null} restores the default behavior. * * @param maximumSize a {@code Dimension} containing the * desired maximum allowable size @@ -2793,10 +2806,18 @@ Dimension old; if (maxSizeSet) { old = this.maxSize; - } - else { + } else { old = null; } + if (isMinimumSizeSet() && maximumSize != null) { + Dimension lMinSize = getMinimumSize(); + if (maximumSize.width < lMinSize.width) { + maximumSize.width = lMinSize.width; + } + if (maximumSize.height < lMinSize.height) { + maximumSize.height = lMinSize.height; + } + } this.maxSize = maximumSize; maxSizeSet = (maximumSize != null); firePropertyChange("maximumSize", old, maximumSize);