<AWT Dev> [9] Review request for 8065739 [macosx] Frame warps to lower left of screen when displayed
Alexander Scherbatiy
alexandr.scherbatiy at oracle.com
Wed Apr 8 14:54:02 UTC 2015
Hello,
Could you review the fix:
bug: https://bugs.openjdk.java.net/browse/JDK-8065739
webrev: http://cr.openjdk.java.net/~alexsch/8065739/webrev.00
Use case:
------------
Frame frame = new Frame();
frame.pack();
frame.setBounds(screenBounds);
frame.setVisible(true);
------------
The frame is in the normal state but Mac OS X treats a frame with
screen bounds as zoomed.
The setVisible() method calls unmaximize() method to return the
zoomed window to the normal state.
The native zoom() method sets the initial sizes for the window which
are zero because of the pack() call.
There is already checkZoom() method which synchronizes native window
zoom state and and the frame extended state when a frame is resized by
mouse.
However it can't be always used for the synchronization between
native window zoom state and setBounds() call because of the following case:
-----------------
Frame frame = new Frame();
frame.setBounds(smallBounds);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
-----------------
This is the valid scenario where the frame should be maximized.
The solution synchronizes the zoom and the frame state only when the
native window is zoomed.
In opposite case we need to return from the zoomed sizes to previous
sizes which are the same as for the zoomed window.
Thanks,
Alexandr.
More information about the awt-dev
mailing list