Disposition d'un tableau de boutons dans un JPanel
Voila bonjour à tous,
J'aimerais savoir comment disposer un tableau de JButton[][] dans un JPanel grace a GridLayout...
Voici la fonction en question:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
public Bouton_test(String titre)
{
super(titre);
GridLayout test= new GridLayout(nl,nc);
JPanel jp_centre= new JPanel(test);
JButton[][] jb_essai= new JButton[3][3];
JButton res=new JButton("TEST");
for (int i=0;i<3;i++)
{
for (int j=0;j<3;j++)
{
jb_essai[i][j]=res;
jp_centre.add(jb_essai[i][j]);
}
}
this.add(jp_centre); |
Merci d'avance et bon dimanche :wink: