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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
package taxes.graphique;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import taxes.Famille;
public class SaisieFamille extends JFrame implements ActionListener{
private static final long serialVersionUID = 1L;
JTextField CodeVillage;
JTextField CodeFamille;
JTextField NomChefFamille;
JTextField PreChefFamille;
JTextField message;
JButton fermer;
JButton ajouter;
JLabel CodeVil;
JLabel CodeF;
JLabel NomCF;
JLabel PrenCF;
public SaisieFamille() {
setTitle("Nouvelle famille");
setBounds(10,40,500,400);
CodeVil = new JLabel("Code Village : ");
CodeVillage = new JTextField(15);
CodeVillage.setMaximumSize(CodeVillage.getPreferredSize());
Box hBox1 = Box.createHorizontalBox();
hBox1.add(CodeVil);
hBox1.add(Box.createHorizontalStrut(5));
hBox1.add(CodeVillage);
CodeF = new JLabel("Code Famille : ");
CodeFamille = new JTextField(20);
CodeFamille.setMaximumSize(CodeFamille.getPreferredSize());
Box hBox2 = Box.createHorizontalBox();
hBox2.add(CodeF);
hBox2.add(Box.createHorizontalStrut(5));
hBox2.add(CodeFamille);
NomCF= new JLabel("Nom Chef Famille : ");
NomChefFamille = new JTextField(25);
NomChefFamille.setMaximumSize(NomChefFamille.getPreferredSize());
Box hBox3 = Box.createHorizontalBox();
hBox3.add(NomCF);
hBox3.add(Box.createHorizontalStrut(5));
hBox3.add(NomChefFamille);
PrenCF= new JLabel("Prénom Chef Famille : ");
PreChefFamille = new JTextField(30);
PreChefFamille.setMaximumSize(PreChefFamille.getPreferredSize());
Box hBox4 = Box.createHorizontalBox();
hBox4.add(PrenCF);
hBox4.add(Box.createHorizontalStrut(5));
hBox4.add(PreChefFamille);
Box hBox5 = Box.createHorizontalBox();
hBox5.add(Box.createHorizontalStrut(15));
hBox5.add(Box.createGlue());
hBox5.add(ajouter = new JButton("Ajouter"));
ajouter.addActionListener(this);
Box hBox6 = Box.createHorizontalBox();
hBox6.add(Box.createGlue());
hBox6.add(fermer = new JButton("Fermer"));
fermer.addActionListener(this);
message = new JTextField(30);
message.setMaximumSize(message.getPreferredSize());
Box hBox7 = Box.createHorizontalBox();
hBox7.add(Box.createHorizontalStrut(5));
hBox7.add(message);
Box vBox = Box.createVerticalBox();
vBox.add(hBox1);
vBox.add(hBox2);
vBox.add(hBox3);
vBox.add(hBox4);
vBox.add(hBox5);
vBox.add(hBox6);
vBox.add(hBox7);
vBox.add(Box.createGlue());
/*========================================================*/
Container c = getContentPane();
c.add(vBox,BorderLayout.WEST);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//Fermeture de cette fenêtre seulement
Image icone=Toolkit.getDefaultToolkit().getImage("./telly.jpg");
setIconImage(icone);
} |
Partager