title: setLocationRelativeTo(null) is not centering the frame
body: <p>I want to position the frame in the center of the screen, but when I typed f.setLocationRelativeTo(null). It is positioning it to the bottom right corner. Is something wrong with the code? If so how can I change it to center the frame?</p>
  
  <pre><code>public class Maze {
  
      public static void main(String[] args) {
          new Maze();
      }
  
      public Maze(){
          JFrame f = new JFrame();
          f.setTitle("Maze Game");
          //f.add(new board());
          f.setLocationRelativeTo(null);
          f.setSize(500, 400);
          f.setVisible(true);
          f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
  
      }
  }
  </code></pre>