title: Set JFrame to center of Screen in NetBeans
body: <p>I am developing a java swing desktop application 
  with NetBeans and I want to set the JFrame to the centre of the screen.</p>
  
  <p>from the net I understand that I can use </p>
  
  <pre><code>setLocationRelativeTo(null);
  </code></pre>
  
  <p>to set the frame to the centre 
  But i am unable to insert the code into the NetBeans IDE
  because both the <code>frame.pack()</code>
  and <code>frame.setVisible()</code> are generated codes of the NetBeans 7 IDE
  and it will not permit any code insertion between the two methods.</p>
  
  <p>I need to to obtain the following :</p>
  
  <pre><code>frame.pack() 
  setLocationRelativeTo(null);
  frame.setVisible()
  </code></pre>
  
  <p>Any suggestion on how to fix the problem?</p>