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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
package test;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class Test extends JFrame {
private JTextField naiss, pren, numenr, nom;
private JLabel naiss_lab, pren_lab, numenr_lab, nom_lab;
public Test() {
Container page = getContentPane();
GridBagLayout c = new GridBagLayout();
page.setLayout(c);
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
nom_lab = new JLabel("Nom de fichier");
gbc.gridx = 0;
gbc.gridy = 0;
c.setConstraints(nom_lab, gbc);
page.add(nom_lab);
nom = new JTextField(20);
gbc.gridx = 1;
gbc.gridy = 0;
c.setConstraints(nom, gbc);
page.add(nom);
numenr_lab = new JLabel("Numéro enregistrement");
gbc.gridx = 0;
gbc.gridy = 1;
c.setConstraints(numenr_lab, gbc);
page.add(numenr_lab);
numenr = new JTextField(20);
gbc.gridx = 1;
gbc.gridy = 1;
c.setConstraints(numenr, gbc);
page.add(numenr);
/*
* nom_lab = new JLabel("Nom :"); page.add(nom_lab); nom = new
* JTextField(20); page.add(nom);
*
*
* pren_lab = new JLabel("Prenom"); page.add(pren_lab); pren = new
* JTextField(20); page.add(pren);
*
*
* naiss_lab = new JLabel("Année de naissance"); page.add(naiss_lab);
* naiss = new JTextField(20); page.add(naiss);
*/
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Consultation de repertoire");
setSize(500, 500);
setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Test t = new Test();
}
});
}
} |
Partager