title: Can't get equal width columns with GridBagLayout layout manager
body: <p>I'm having an issue with GridBagLayout() and having even column widths. Essentially, I'm adding three buttons to a panel with a GridBagLayout lahyout manager. I expect (want) the widths of the buttons to be the same, and to fill the cell they are in. However, because the buttons are of different sizes (dependent on the text in them), I end up having buttons of different sizes. Below is the code:</p>
  
  <pre><code>import java.awt.Dimension;
  import java.awt.GridBagConstraints;
  import java.awt.GridBagLayout;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.swing.*;
  
  
  public class ShitHeadGUI extends JPanel {
  
      public String[] s = new String[] {"Ace of Hearts", "2 of Diamonds", "3 of Clubs"};
  
  
      //JPanel pile = new JPanel();
      List&lt;JPanel&gt; hands = new ArrayList&lt;JPanel&gt;();
      GridBagConstraints cons = new GridBagConstraints();
      JFrame frame = new JFrame("Shithead");
  
      public ShitHeadGUI() {
          this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
          this.setPreferredSize(new Dimension(300,300));
  
          cons.gridx = 0;
          cons.gridy = 0;
          cons.weightx = 1;
          cons.fill = GridBagConstraints.HORIZONTAL;
  
          for (int i = 0; i &lt; 2; i++) {
              hands.add(new JPanel());
              hands.get(i).setLayout(new GridBagLayout());
              this.add(hands.get(i));
              cons.gridy++;
          }
  
          frame.setVisible(true);
          frame.add(this);
          frame.pack();   
  
          addCards(null);
      }
  
      public void addCards(Hand h) {
  
          List&lt;JButton&gt; btnCard = new ArrayList&lt;JButton&gt;();
  
          for (int i = 0; i &lt; 3; i++) {//h.size(); i++) {
              cons.gridx = i;
              //btnCard.add(new JButton(h.getCard(i).toString()));
              btnCard.add(new JButton(s[i]));
              hands.get(0).add(btnCard.get(i), cons);
          }       
      }
  }
  </code></pre>
  
  <p>The "Ace of Hearts" is a little different than the "2 of Diamonds" size and the "3 of clubs" is noticeably smaller. I want them all to be equal size. Any help would be appreciated, thanks!!</p>