On Tue, 19 Jul 2022 23:52:44 GMT, Harshitha Onkar <[email protected]> wrote:
>> test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 292:
>>
>>> 290: }
>>> 291: else if (position.equals(Position.TOP_LEFT_CORNER)) {
>>> 292: frame.setLocation(0,0);
>>
>> I am very sceptical of this. With a toolbar on the left and a menu bar on
>> the top of the screen I bet you
>> are neither at x=0 or y=0.
>> And this code is not allowing the desktop to reposition it and report the
>> updated REAL position back to you
>> The result will be overlapping windows.
>> I'm actually dubious of the existing code for much the same reason but it
>> just likely hasn't been seen as a problem there because positioning in the
>> middle of the screen usually gets you where you asked for.
>
> @prrace Thank you for reviewing. I do see your point - when taskbars and menu
> bars are located on top or left side of the screen, they would overlap the
> test instruction frame.
>
> Two possible solutions:
>
> 1. Going with a fixed amount of offset on where to position the top-left
> corner of the instruction frame window. Probably this would not be ideal
> considering different screen settings and platforms.
>
> 2. The other approach would be to use
> [GraphicsEnvironment.getMaximumWindowBounds()](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/GraphicsEnvironment.html#getMaximumWindowBounds())
> to get the displayable window size and position the instruction frame
> accordingly ?
More than that - this code needs to call setlocation, and do "whatever" to make
sure that is actually pushed to the "window manager" and the REAL location of
the window come back. The way the code is written it sets a couple of vars and
then reads back its own values .. no chance of finding the REAL location
-------------
PR: https://git.openjdk.org/jdk/pull/9525