RFR: JDK-8290469: Add new positioning options to PassFailJFrame test framework [v3]

Harshitha Onkar honkar at openjdk.org
Wed Jul 20 00:04:03 UTC 2022


On Tue, 19 Jul 2022 23:10:37 GMT, Phil Race <prr at openjdk.org> wrote:

>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   window positioning changes
>
> 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 ?

-------------

PR: https://git.openjdk.org/jdk/pull/9525



More information about the client-libs-dev mailing list