Hi,
So my problem is that my code at the moment is supposed to create a table of JButtons that resize when the window resizes. Well that is my issue anyway. At the moment, the buttons do appear and the window is able to resize, but the buttons do not resize with the window. Tips on how to correct this would be great. I feel like the problem is in the addButtons method, but I'm not sure what. I did have a friend test this code and it worked(the JButtons resized when the window was), but I cannot get the Buttons to do it on any of my two computers. Again, Thanks for helping.

Code:
import java.awt.ComponentOrientation;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import javax.swing.JFrame;
import java.util.Scanner;
import javax.swing.JPanel;
import java.awt.GridLayout;

public class DisplayBoard2 {
public static void addButtons(JPanel panel, GameOfLife game, GridBagConstraints constraints){
/*
This is supposed to be part of the GUI for Conway's game of Life, but the other classes used(GameOfLife and Board) have no issues and the methods used all return proper values. 
*/
		JButton button;
		panel.setLayout(new GridLayout());
		for(int x =0; x<game.getBoard().getRow(); x++){
			for(int y = 0; y<game.getBoard().getCol(); y++){
				button = new JButton();
				constraints.fill = GridBagConstraints.BOTH;
				constraints.gridx = x;
				constraints.gridy = y;
				panel.add(button, constraints);
			}
		}
	}
	
	public static void showGui(){
        Scanner scan = new Scanner(System.in);
        GameOfLife game = new GameOfLife();
        GridBagConstraints constraints = new GridBagConstraints();
        game.createBoard(scan);
        JFrame frame = new JFrame();
        JPanel panel = new JPanel();
        frame.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new GridBagLayout());
        constraints.fill = GridBagConstraints.BOTH;
        frame.setSize(400, 400);
        DisplayBoard.addButtons(panel, game, constraints);
        frame.add(panel);
        frame.setVisible(true);      
        }



	public static void main(String[] args){
            	DisplayBoard.showGui();
            	}
		;
	}