title: Improper sizing using GridBagLayout
body: <p>I am trying to use a GridBagLayout to have a JFrame that contains a JPanel that has a grid layout and a JPanel with just a large button.  I want the rows to all be the same size, and the JPanel with the JButton to be the same size as one row.  However, the button panel, which is currently empty, is about 1/3 of the JFrame.  I'm not quite sure what's happening, but it is pretty important to me that I maintain this structure because the rest of my code uses this.  Any help is appreciated, and thank you in advance.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import javax.swing.border.*;
  
  public class Minesweeper extends JPanel {
          private final int SIZE = 7;
  
          public void startGame(){
                  JFrame holder = new JFrame();
                  JPanel window = new JPanel();
                  JPanel pan = new JPanel();
                  holder.setLayout(new GridBagLayout());
                  GridBagConstraints con = new GridBagConstraints();
                  con.weightx = 1;
                  con.weighty = 1;
                  con.gridx = 0;
                  con.gridy = 0;
                  con.fill = GridBagConstraints.BOTH;
                  con.gridheight = SIZE;
                  con.gridwidth = SIZE;
                  holder.getContentPane().setBackground(Color.darkGray);
                  holder.setSize(450, 450);
                  holder.setResizable(false);
                  holder.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                  window.setBackground(Color.darkGray);
                  window.setLayout(new GridLayout(SIZE, SIZE));
                  for (int c=0; c&lt;(SIZE*SIZE); c++){
                          int row = (c/SIZE);
                          int col = (c%SIZE);
                          JPanel p = new JPanel();
                          p.setBackground(Color.gray);
                          Border b = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
                          p.setBorder(b);
                          window.add(p);
                  }
                  holder.add(window, con);
                  con.gridx = 0;
                  con.gridy = SIZE+1;
                  con.gridheight = 0;
                  con.gridwidth = SIZE;
                  holder.add(pan, con);
                  holder.setVisible(true);
          }
  
          public static void main(String[] args){
                  Minesweeper start = new Minesweeper();
                  start.startGame();
          }
  }
  </code></pre>
  
  <p>This is what is being shown:</p>
  
  <p><a href="https://i.stack.imgur.com/HvguY.png" rel="nofollow"><img src="https://i.stack.imgur.com/HvguY.png" alt="https://i.stack.imgur.com/HvguY.png"></a></p>