On Fri, 11 Nov 2022 04:01:17 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> Please recheck, setLocationRelativeTo() calculates the location based on the >> size of the current frame, which is wrong before the pack. I just run it and >> the frame is sifted to the right part of the screen. > > WHich platform it is shifted? I guess on any, I have tested on windows, and now on macOS. Add these lines to the end of method, and check how the frame will jump to the center: frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); + robot.delay(3000); + frame.dispose(); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); ------------- PR: https://git.openjdk.org/jdk/pull/11057