[debutant] probleme de GridLayout
me code marche, mais le probleme, j'aimerai aligner tout les mot(nom, prenom, adresse.... en au de la feuille), mais je ne sais pas comment faire...si ya une ame aimable....un grand merci ^_^
[c'est une partie de mon application mais complet pour l'apel de la classe]
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MenuModifier extends Frame{
public JPanel pane2;
public GridBagLayout gridbag;
public GridBagConstraints constraints;
Label nom;
Label prenom;
Label adresse;
Label ville;
Label commune;
Label dateNaiss;
Label numTel;
public MenuModifier(){
super("Menu Modifier");
//this.interf=interf; //AJOUT
System.out.println("Start program...");
setBounds(100,100,800,600);
pane2=new JPanel();
setBackground(Color.gray);
GridLayout grid=new GridLayout(1, 7, 2, 2);
setLayout(grid);
add(new Label("Nom"),"North");
add(new Label("Prénom"),"North");
add(new Label("Adresse"),"North");
add(new Label("Ville"),"North");
add(new Label("Commune"),"North");
add(new Label("Date de naissance"),"North");
add(new Label("Numéro de téléphone"),"North");
show();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.out.println("fermeture de la fenetre -modifier-");
}
});
}
public static void main(String args[]) {
MenuModifier mod= new MenuModifier();
}
} |