Search code examples
javaswingjframecentering

Location of JFrame in middle of the window


My JFrame window always starts at the upper left corner. I want it to start in the middle of the screen. How can I solve this problem?


Solution

  • Another simple method:

    frame.setLocationRelativeTo(null);