On Wed, 15 Sep 2021 08:22:03 GMT, Alisen Chung
<[email protected]> wrote:
>> test/jdk/java/awt/event/MouseEvent/ResizeMouseExitEnterMisfire/ResizeMouseExitEnterMisfire.java
>> line 61:
>>
>>> 59: public void run() {
>>> 60: frame = new JFrame();
>>> 61: frame.setSize(200, 200);
>>
>> It is preferred to move the frame to centre of screen by calling
>> frame.setLocationRelativeTo(null)
>
> I use the frame size to find the correct location of the mouse for robot, so
> moving the frame to the center of the screen would make calculating mouse
> locations more complicated...
> And I need some space to expand the window, which could be limited if the
> frame were to be in the center, so in this case it's probably better to keep
> the window in the top left corner? Unless there's a reasoning I missed for
> moving it to the center?
This is done because the Robot sometime ends up clicking on Taskbar or side bar
on Linux and we have had some related issue. Moving to centre helps to avoid
those issues. Also, you just need to call frame.getLocationOnScreen to get the
location along with the frame.bounds to get correct location. But this all is
optional/preferred and it is fine you would like to keep the frame in left top.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5497