le positionnement en java
Bonjour,
je ne comprends pas mon code...Je suis en train de faire un Tp en java avec Swing...
Seulement, je dois placer les widgets comme ceci ::
[IMG]C:\Documents and Settings\olive\Bureau\tp.JPG[/IMG]
mon code de placement est le suivant ::
Code:
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 27 28 29 30 31 32 33 34 35 36 37 38
|
this.labelComboBox1.setText("Répertoire Sélectionné: ");
this.labelComboBox2.setText("Répertoire Sélectionné: ");
this.comboBox1 = new MComboBox();
this.comboBox2 = new MComboBox();
this.list1 = new MJlist(this.m.getData());
this.list2 = new MJlist(this.m.getData());
this.statutBar1 = new JLabel();
this.statutBar2 = new JLabel();
//Positionnement
//BOX GAUCHE
this.boxH1 = Box.createHorizontalBox();
this.boxH1.add(this.labelComboBox1);
this.boxH1.add(this.comboBox1);
//BOX DROITE
this.boxH2 = Box.createHorizontalBox();
this.boxH2.add(this.labelComboBox2);
this.boxH2.add(this.comboBox2);
this.boxGauche =Box.createVerticalBox();
this.boxGauche.add(this.boxH1);
this.boxGauche.add(new JScrollPane(this.list1));
this.boxGauche.add(this.statutBar1);
this.boxDroite =Box.createVerticalBox();
this.boxGauche.add(this.boxH2);
this.boxGauche.add(new JScrollPane(this.list2));
this.boxGauche.add(this.statutBar2);
this.boxCentre = Box.createHorizontalBox();
this.boxCentre.add(this.boxGauche);
this.strutH = Box.createHorizontalStrut(20);
this.boxCentre.add(this.strutH);
this.boxCentre.add(this.boxDroite);
this.add(this.boxCentre,BorderLayout.CENTER); |
voila ce que j'obtient ::
[IMG]C:\Documents and Settings\olive\Bureau\tp1.JPG[/IMG]
j'utilise un BorderLayout.
Le resultat est incohérent, normalement je devrai avoir le tout cote a cote et non l'un en dessus de l'autre....
Ci quelqu'un voit le soucis ....