title: How to embed a grid layout inside a border layout in java
body: <p>I have a border layout and I want to add a grid layout to the center section. However, I can't declare a grid and then add my center border. How can I do this?</p>
  <pre><code>public Liability_Calculator(String s)
  {
      super(s);
      setSize(325,200);
      
      c = getContentPane();
      c.setLayout(new BorderLayout());
      
      //the top label
      total = new JLabel(&quot;Total monthly liabilities &quot;, JLabel.CENTER);
      c.add(total, BorderLayout.NORTH);
      
      
      //the grid
      GridLayout grid = new GridLayout(2,2);
      
      text_field1 = new JTextField(7);
      
      //I GET AN ERROR HERE!!!!!!!
      grid.add(text_field1);
  
      //AND ERROR HERE!!!!!!!!!!!!!
      c.add(grid, BorderLayout.CENTER);
      
      
  
      
      setVisible(true);
  }
  </code></pre>