title: Insert a new row to GridBagLayout by code from another component
body: <p>I have a JFrame with some controls positionned with GridBagLayout like this:</p>
  
  <pre><code>setLayout(new GridBagLayout());
  final GridBagConstraints c = new GridBagConstraints;
  ...
  this.add(control, c);
  ...
  </code></pre>
  
  <p>And I want to insert a row with textfield by code from a button. Is possible to do this ??
  I don't have a reference to GridBagConstraints, from now I do it like this:</p>
  
  <pre><code>final GridBagConstraints c = new GridBagConstraints;
  c.gridx = 0;
  c.gridy = 0;
  ...
  myframereference.add(mytextfield, c);
  ...
  </code></pre>
  
  <p>It work and I have a new row at top with my textfield, but when I specify my correct position (gridx = 0 and gridy = 2), all layout breaks.</p>
  
  <p>Thank you.</p>
  
  <p><strong><em>EDIT:</em></strong></p>
  
  <p>For more informations, a runnable example, I want to insert a new row between label 1 and label 3 from another frame.</p>
  
  <pre><code>package test;
  
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  
  public class LayoutExample extends JFrame {
  
      public LayoutExample()
      {
          super("Layout Example");
      }
  
      private void createAndDisplayGUI()
      {       
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  
          setLayout(new GridBagLayout());
          final GridBagConstraints c = new GridBagConstraints();
  
          c.gridx = 0;
          c.gridy = 0;
          c.insets = new Insets(2, 3, 2, 2);
          c.fill = GridBagConstraints.HORIZONTAL;
          c.anchor = GridBagConstraints.WEST;
  
          final JPanel contentPane = new JPanel();
          contentPane.setLayout(new GridBagLayout());
  
          // Row 1
          final JLabel label1 = new JLabel("Label 1");
          label1.setHorizontalAlignment(SwingConstants.RIGHT);
          contentPane.add(label1, c);
  
          final JTextField textfield1 = new JTextField(8);
          c.gridx++;
          contentPane.add(textfield1, c);
  
          //------
  
          final JLabel label2 = new JLabel("Label 2");
          label2.setHorizontalAlignment(SwingConstants.RIGHT);
          c.gridx++;
          contentPane.add(label2, c);
  
          final JTextField textfield2 = new JTextField(8);
          c.gridx++;
          contentPane.add(textfield2, c);
  
          // Row 2
          final JLabel label3 = new JLabel("Label 3");
          label3.setHorizontalAlignment(SwingConstants.RIGHT);
          c.gridx = 0;
          c.gridy++;
          contentPane.add(label3, c);
  
          final JTextField textfield3 = new JTextField(8);
          c.gridx++;
          contentPane.add(textfield3, c);
  
          //------
  
          final JLabel label4 = new JLabel("Label 4");
          label4.setHorizontalAlignment(SwingConstants.RIGHT);
          c.gridx++;
          contentPane.add(label4, c);
  
          final JTextField textfield4 = new JTextField(8);
          c.gridx++;
          contentPane.add(textfield4, c);
  
          setContentPane(contentPane);
          pack();
          setLocationByPlatform(true);
          setVisible(true);
      }
  
      public static void main(String[] args)
      {
          SwingUtilities.invokeLater(new Runnable()
          {
              public void run()
              {
                  new LayoutExample().createAndDisplayGUI();
              }
          });
      }
  }
  </code></pre>