en gros quand tu construit ton panel tu fais :
1 2
|
JPanel monPanel = new JPanel(new GridBagConstraints()); |
et ensuite tu creer un objet
GridBagConstraints c = new GridBagConstraints();
1 2 3 4
| Après tu modifie cet objet :
c.gridx = 3; //3e ligne
c.gridy = 2; //2e colonne
c.insets = new Insets(10,20,30,40); //10 d'espace en haut, 20 a gauche, 30 en bas et 40 a droite |
etc.. ya plusieurs autre option
et ensuite quand tu ajoute ton bouton par exemple tu fais :
monPanel.add(monBouton,c);
ensuite tu modifie encore ton objet c pour un autre composant etc...
voila j'espère que j'ai été claire
Partager