title: How can I make a component span multiple cells in a GridBagLayout
body: <p>I have to make this for school:</p>
  
  <p><img src="https://i.stack.imgur.com/rqs8L.png" alt="GUI"></p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class AddressBookGui1 extends JFrame {
  public AddressBookGui1(){
  
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);
  
      JLabel label;
      JButton button;
      JTextField textField;
      JTextArea textArea = new JTextArea(10, 20);
  
      gbc.weightx = 1;
      label = new JLabel("text");
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 0;
      gbc.gridy = 0;
      add(label ,gbc);
  
      textField = new JTextField();
      gbc.weightx = 1;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 1;
      gbc.gridy = 0;
      add(textField ,gbc);
  
      label = new JLabel("text");
      gbc.weightx = 1;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.gridwidth = 1;
      add(label ,gbc);
  
      textField = new JTextField();
      gbc.weightx = 1;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 1;
      gbc.gridy = 1;
      gbc.gridwidth = 2;
      add(textField, gbc);
  
      label = new JLabel("text");
      gbc.weightx = 1;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 0;
      gbc.gridy = 2;
      gbc.gridwidth = 1;
      add(label ,gbc);
  
      textField = new JTextField();
      gbc.weightx = 1;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 1;
      gbc.gridy = 2;
      gbc.gridwidth = 2;
      add(textField, gbc);
  
      label = new JLabel("text");
      gbc.weightx = 1;
      gbc.anchor = GridBagConstraints.FIRST_LINE_START;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 0;
      gbc.gridy = 3;
      gbc.gridwidth = 1;
      add(label ,gbc);
  
  
  
      gbc.weightx = 1;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.anchor = GridBagConstraints.CENTER;
      gbc.gridwidth = 2;
      gbc.gridx = 1;
      gbc.gridy = 3;
  
      add(textArea, gbc);
  
      gbc.weightx = 1;
      button = new JButton("text");
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridwidth = 1;
      gbc.gridx = 0;
      gbc.gridy = 4;
      add(button ,gbc);
  
      gbc.weightx = 1;
      button = new JButton("text");
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 3;
      gbc.gridy = 4;
      add(button ,gbc);
  
  
  
  }
  public static void main(String[] args){
    AddressBookGui1 frame = new AddressBookGui1();
    frame.setTitle("Address Book");
    frame.setSize(400, 300);
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true); 
  }
  
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/gZLke.png" alt="This is the result"></p>
  
  <p>(I still need to deal with padding and insets. I've gotten those to work in a much simpler program so I think I have a handle on that stuff)</p>
  
  <p>I've tried the GridBagLayout Oracle tutorial and I'm not sure what I'm doing wrong. Can someone help me make it look more like it is supposed to? Specifically to make the text fields and text area span over 2 cells.</p>