Ajouter des boutons à l'aide de gridlayout

Je suis en train de créer un simple tic tac toe conseil faite par 9x9 JButtons.
J'ai utilisé un tableau 2d et un gridlayout mais le résultat n'est rien, une image sans aucun bouton.
Ce que je fais mal?

import java.awt.GridLayout;
import javax.swing.*;


public class Main extends JFrame
{
    private JPanel panel;
    private JButton[][]buttons;
    private final int SIZE = 9;
    private GridLayout experimentLayout;
    public Main()
    {
        super("Tic Tac Toe");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(500,500);
        setResizable(false);
        setLocationRelativeTo(null);

        experimentLayout =  new GridLayout(SIZE,SIZE);

        panel = new JPanel();
        panel.setLayout(experimentLayout);


        buttons = new JButton[SIZE][SIZE];
        addButtons();


        add(panel);
        setVisible(true);
    }
    public void addButtons()
    {
        for(int k=0;k<SIZE;k++)
            for(int j=0;j<SIZE;j++)
            {
                buttons[k][j] = new JButton(k+1+", "+(j+1));
                experimentLayout.addLayoutComponent("testName", buttons[k][j]);
            }

    }


    public static void main(String[] args) 
    {
        new Main();

    }

}

La addButton méthode est d'ajouter les boutons vers le tableau et tout de suite après le panneau.

OriginalL'auteur Imri Persiado | 2012-12-09