<AWT Dev> [9] setMaximumSize() and setMaximizedBounds()

Anthony Petrov anthony.petrov at oracle.com
Mon Dec 23 07:18:53 PST 2013


> Similar question: how we should handle situation when max size is smaller than minimum size.

The setters should ensure the sizes are always reasonable (i.e. minimum 
<= maximum && minimum <= maximized).
As for maximum vs. maximized - this is what we're discussing in this thread.

--
best regards,
Anthony

On 12/20/2013 02:34 AM, Sergey Bylokhov wrote:
> Hi.
> Just my 2 cents. From my point of view the calls below  looks similar
> and should behave in the same way:
> 1 setMaximumSize/setMinimumSize + setBounds.
> 2 setMaximumSize/setMinimumSize + setMaximizedBounds+"setMaximumState".
> 3 setMaximumSize/setMinimumSize + resize by the user.
> 4 setMaximumSize/setMinimumSize + setMaximizedBounds+maximisation/zoom
> by the user.
> No?
> Similar question: how we should handle situation when max size is
> smaller than minimum size.
>
> On 19.12.2013 23:18, Anthony Petrov wrote:
>> But users may still want to have a shortcut to "maximize" a window in
>> case #3. How about we still allow for maximizing a window, but use its
>> maximum size instead of the maximized bounds as the size for a
>> maximized window? In other words, the maximum size (if set) has a
>> precedence over the maximized bounds.
>>
>> --
>> best regards,
>> Anthony
>>
>> On 12/19/2013 03:58 PM, Artem Ananiev wrote:
>>>
>>> On 12/19/2013 2:46 PM, Alexander Zvegintsev wrote:
>>>> Hello AWT team,
>>>>
>>>> I am currently looking at JDK-6464548 issue[1], and as you can see in
>>>> javadoc[2]
>>>> we have only setMinimumSize() implemented in java.awt.Window and
>>>> setMaximumSize() is not implemented.
>>>>
>>>> So my question is about how setMaximumSize() (and setMinimumSize())
>>>> should interfere with setMaximizedBounds()[3]?
>>>>
>>>> I see several options here:
>>>>
>>>> 1. setMaximizedBounds() refers to a different state and does not depend
>>>> on setMaximumSize() and setMinimumSize()
>>>> 2. setMaximizedBounds() respects setMaximumSize() and setMinimumSize().
>>>> If the window is maximized and maximized
>>>> bounds does not conform with maximum or minimum size then window will
>>>> shrunk or enlarge to honor these sizes.
>>>> 3. If maximum size is set then we deny window maximize operation and
>>>> setMaximizedBounds() have no effect.
>>>>
>>>> What do you think?
>>>
>>> I would vote for #2 or #3. #3 seems to be slightly better than #2,
>>> because to implement #2 we'll need to track, what was called first,
>>> setMaximumSize() or setMaximizedBounds(). Another problem is that if we
>>> restrict the maximized bounds to conform to minimum/maximum size, when a
>>> window is maximized it won't occupy the right place as requested by the
>>> application. In other words, I think that in case #2 maximized bounds
>>> feature is broken anyway, so it doesn't make sense to allow window
>>> maximization at all (which is exactly #3).
>>>
>>> Thanks,
>>>
>>> Artem
>>>
>>>> [1] https://bugs.openjdk.java.net/browse/JDK-6464548
>>>> [2]
>>>> http://docs.oracle.com/javase/7/docs/api/java/awt/Window.html#setMinimumSize(java.awt.Dimension)
>>>>
>>>>
>>>>
>>>> [3]
>>>> http://docs.oracle.com/javase/7/docs/api/java/awt/Frame.html#setMaximizedBounds(java.awt.Rectangle)
>>>>
>>>>
>>>>
>>>>
>>>>
>
>


More information about the awt-dev mailing list