title: Starting GridBagLayout from top left corner in Java Swing
body: <p>I'm new to Java Swing and I have been struggling to start the GridBagLayout from top left corner so that c.gridx=0 c.gridy=0 will put my object on the top left corner.</p>
  
  <p>I'd appreciate if you could help me by telling what I need to do after this point:</p>
  
  <pre><code>    JPanel panel = new JPanel(new GridBagLayout());
      frame.add(panel);
      GridBagConstraints c = new GridBagConstraints();
  </code></pre>
  
  <p>I know that I have to use NORTHWEST or FIRST_LINE_START constants, but I don't know how. I tried to do it this way' but it did not realize the constants.</p>
  
  <pre><code>    frame.getContentPane().add(panel, BorderLayout.NORTHWEST);
  </code></pre>
  
  <p>Thanks for your help.</p>