Bonjour à tous,
J'ai un panel pour lequel j'ai plusieurs composants et j'aimerais qu'il soit tous en haut de page.
Je voudrais ce résultat :
http://img542.imageshack.us/img542/2548/nordx.jpg
Avec ce code j'obtiensCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 this.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTH; c.gridx = 0; c.gridy = 0; this.add(new JButton("1"), c); c.gridx = 1; c.gridy = 0; this.add(new JButton("2"), c); c.gridx = 0; c.gridy = 1; this.add(new JButton("3"), c); c.gridx = 1; c.gridy = 1; this.add(new JButton("4"), c); c.gridx = 0; c.gridy = 2; this.add(new JButton("5"), c); c.gridx = 1; c.gridy = 2; this.add(new JButton("6"), c);
http://img580.imageshack.us/img580/4366/centrei.jpg
Et si j'ajoute la ligne : c.weighty = 1.0;
J'obtiens :
http://img37.imageshack.us/img37/2153/weight1.JPG
Si quelqu'un peut m'aider ça serait génial.
Merci d'avance.