Fix Window Placement in Java Swing


Comments:


Java Swing apps by default force themselves into the upper-left corner of the screen, ignoring whatever window-placement policy the system has. This is a UI mistake, and this bug has been reported to Sun many times, going back all the way to 1997. Instead of fixing the default behavior, they made it an optional parameter:

JFrame frame = new JFrame();
frame.setLocationByPlatform(true);