<AWT Dev> [9] Review request 6383434: Frame.setMaximumSize() doesn't work

Alexander Zvegintsev alexander.zvegintsev at oracle.com
Thu Jan 23 11:14:04 PST 2014


This case is legalized in javadoc:
src/share/classes/java/awt/Window.java:
878      * If the minimum size of this window is greater than {@code 
maximumSize}
879      * then minimum size will be applied.

This situation may sounds weird, but it handled in the same way across 
all platforms by system hints:
min size hint is more powerful than max size, so I didn't add any any 
additional handling for this case.
But possibly, we should do that explicitly.

--
Thanks,
Alexander.

23.01.2014 20:12, Petr Pchelko wrote:
>> This is done for following case:
>> We have a frame with
>>         f.setMinimumSize(new Dimension(200, 200));
>>         f.setMaximumSize(new Dimension(100, 100));
>>
>> Call to f.setMinimumSize(null); will remove minimum size hints and only maximum size hints (100x100) should be applied,
>> but window will remain 200x200 size until next move or resize. So here we resize window to fit the maximum size immediately.
> Hmm… Should it be legal to set the MaximumSize < MinimumSize? What should take precedence in this case? Quite a weird situation..
>
> With best regards. Petr.
>
> 23 янв. 2014 г., в 7:59 после полудня, Alexander Zvegintsev <alexander.zvegintsev at oracle.com> написал(а):
>
>> Hi Petr,
>> please see in-line:
>>
>> On 01/23/2014 07:25 PM, Petr Pchelko wrote:
>>> Hello, Alexander.
>>>
>>> Does your fix also address https://bugs.openjdk.java.net/browse/JDK-7124365 ? As I understand, it’s not?
>> Yes, it isn't. From my understanding, there is no way to maximize window to size smaller than
>> screen size (excluding dock and menubar) on Mac OS. Such windows are considered as not maximized.
>>
>> Javadoc says:
>>      * Note, the given maximized bounds are used as a hint for the native
>>      * system, because the underlying platform may not support setting the
>>      * location and/or size of the maximized windows.
>>
>> I think that Mac OS is the case when this feature is not supported and 7124365 may be closed as not an issue.
>>> Could you please update the copyright years.
>> Done in place.
>>> I have a concern about Window.setMinimumSize update. Why are you adding it?
>> This is done for following case:
>> We have a frame with
>>         f.setMinimumSize(new Dimension(200, 200));
>>         f.setMaximumSize(new Dimension(100, 100));
>>
>> Call to f.setMinimumSize(null); will remove minimum size hints and only maximum size hints (100x100) should be applied,
>> but window will remain 200x200 size until next move or resize. So here we resize window to fit the maximum size immediately.
>>> XDecoratedPeer.java has some space-only changes.
>> It is intentional.
>>> Also it would be great to have a couple of tests)
>> I'll add some tests later.
>>
>> Thanks,
>>
>> Alexander.
>>
>>> With best regards. Petr.
>>>
>>> 23 янв. 2014 г., в 6:55 после полудня, Alexander Zvegintsev <alexander.zvegintsev at oracle.com> написал(а):
>>>
>>>> Hello AWT team,
>>>> please review the fix
>>>> http://cr.openjdk.java.net/~azvegint/jdk/9/6464548/webrev.00/
>>>> for
>>>> https://bugs.openjdk.java.net/browse/JDK-6464548 Reopen
>>>> https://bugs.openjdk.java.net/browse/JDK-6464551 XAWT: Frame.setMaximizedBounds restricts resizing
>>>>
>>>> setMinimumSize() for java.awt.Window was implemented in JDK 6. I think it is time to implement setMaximumSize at least in JDK 9 :)
>>>>
>>>> -- 
>>>> Thanks,
>>>>
>>>> Alexander.
>>>>



More information about the awt-dev mailing list