ihssan09
Messages postés4Date d'inscriptionmardi 28 avril 2009StatutMembreDernière intervention25 septembre 2012
-
20 janv. 2010 à 03:15
apprentizakaria
Messages postés8Date d'inscriptionjeudi 28 avril 2011StatutMembreDernière intervention19 juillet 2011
-
19 juil. 2011 à 12:04
Bonsoir,
s'il vous plait mes amis ,est ce que quelqu'un d'entre vous peut m'aider à résoudre les erreurs que contient mon code?affin de visualiser mon interface graphique.s'il vous plait je me suis dans une situation très émouvante,aprés demain je doit rendre ce miniprojet ,et je ne l'avait pas encore terminer.
voilà mon code :
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class Agence extends JFrame implements ActionListener {
private JTextField saisie1 = new JTextField();
private JTextField saisie2 = new JTextField();
private JTextField saisie3 = new JTextField();
private JTextField saisie4 = new JTextField();
private JButton creer = new JButton("Creer");
private JButton consulter = new JButton("Consulter");
private JButton effacer = new JButton("Effacer");
private JButton quitter = new JButton("Quitter");
private JLabel nom = new JLabel("Nom");
private JLabel prenom = new JLabel("Prenom");
private JLabel adresse = new JLabel("Adresse");
private JLabel solde = new JLabel("Solde");
private JLabel typeCompt = new JLabel("Types de compte");
private JLabel comptBan = new JLabel("CompteBancaire");
private JLabel comptEpargn = new JLabel("CompteEpargne");
private JLabel comptPayan = new JLabel("ComptePayant");
private JPanel p_nom = new JPanel();
private JPanel p_prenom = new JPanel();
private JPanel p_adresse = new JPanel();
private JPanel p_saisie1 = new JPanel();
private JPanel p_saisie2 = new JPanel();
private JPanel p_saisie3 = new JPanel();
private JPanel p_saisie4 = new JPanel();
private JPanel p_solde = new JPanel();
private JPanel p_creer = new JPanel();
private JPanel p_consulter = new JPanel();
private JPanel p_quitter = new JPanel();
private JPanel p_effacer = new JPanel();
private JPanel p_typeCompt = new JPanel();
private JPanel p_ComptBan = new JPanel();
private JPanel p_ComptEpargn= new JPanel();
private JPanel p_ComptPayant= new JPanel();
private JPanel p_text = new JPanel();
private JPanel panel1 = new JPanel();
private JPanel panel2 = new JPanel();
private JPanel panel3 = new JPanel();
private CheckboxGroup compte = new CheckboxGroup();
private Checkbox compteSimple = new Checkbox();
private Checkbox compteEpargne= new Checkbox();
private Checkbox comptePayant = new Checkbox();
private TextArea text = new TextArea();
private String typescomptes ;//le label du choix coché
//constructeur sans argument
public Agence()
{
Initialiser();
}
public void autoriserSave(){
if((saisie1.getText().length!=0) &&(saisie2.getText().length!=0)&&(saisie3.getText().length!=0))
creer.setEnable(true);
else
creer.setEnable(false);
}
}
private void typesComptes(){
this.autoriserSave();
if (compte.getSelectedCheckbox()!=null)
this.typesComptes=compte.getSelectedCheckbox().getLabel();
else
this.typesComptes="";
}
//Sauvegarde des informations dans un fichiers
public void enregEcrit(String ecrit){
try
{
fluxout.write(ecrit);
fluxout.newLine();
}
catch(IOExeception err)
{
System.out.println("Erreur :"+ err);
}
}
//Initialiser la fenetre
private void Initialiser(){
this.setResizable(false);
this.setTitle("Bonjour ** Creer un Compte Bancaire **");
this.setBounds(200,120,600,580);
this.setSize(300,450);
p_nom.setLayout(null);
p_nom.add(nom);
nom.setBounds(10,120,100,22);
this.add(nom);
p_prenom.setLayout(null);
prenom.setBounds(10,150,100,22);
p_prenom.add(prenom);
this.add(prenom);
p_adresse.setLayout(null);
adresse.setBounds(10,180,100,22);
p_adresse.add(adresse);
this.add(adresse);
p_saisie1.setLayout(null);
saisie1.setBounds(120,120,150,22);
p_saisie1.add(saisie1);
this.add(saisie1);
p_saisie2.setLayout(null);
saisie2.setBounds(120,150,150,22);
p_saisie2.add(saisie2);
this.add(saisie2);
p_saisie3.setLayout(null);
saisie3.setBounds(120,180,100,22);
p_saisie3.add(saisie3);
this.add(saisie3));
p_creer.setLayout(null);
creer.setBounds(370,480,100,28);
p_creer.add(creer);
p_consulter.setLayout(null);
consulter.setBounds(400,480,100,28);
p_consulter.add(consulter);
this.add(consulter);
p_effacer.setLayout(null);
effacer.setBounds(370,520,100,28);
p_effacer.add(effacer);
this.add(effacer);
p_quitter.setLayout(null);
quitter.setBounds(400,520,100,28);
p_quitter.add(quitter);
this.add(quitter);
p_typeCompt.setLayout(null);
p_typeCompt.add(typeCompt);
typeCompt.setBounds(10,520,300,22);
this.add(typeCompt);
p_comptBan.setLayout(null);
p_comptBan.add(comptBan);
comptBan.setBounds(10,550,70,22);
this.add(comptBan);
p_comptEpargn.setLayout(null);
p_comptEpargn.add(comptEpargn);
comptEpargn.setBounds(100,550,70,22);
this.add(comptEpargn);
p_comptPayant.setLayout(null);
p_comptPayant.add(ComptPayant);
comptePayant.setBounds(190,550,70,22);
this.add(comptePayant);
text=new textarea(10,20);
text.setBounds(380,180,250,280);
text.setbackgrund(color.white);
this.add(text);
panel1.setLayout(new GridLayout(4,2));
panel1.add(p_nom);
panel1.add(p_prenom);
panel1.add(p_adresse);
panel1.add(p_solde);
panel2.setLayout(new GridLayout(2,2));
panel2.add(p_creer);
panel2.add(p_consuter);
panel2.add(p_effacer);
panel2.add(p_quitter);
panel2.add(p_text);
panel3.setLayout(new GridLayout(1.4));
panel3.add(typeCompt);
panel3.add(comptBan);
panel3.add(comptEpargn);
panel3.add(comptPayant);
panel4.setLayout(new GridLayout(4.2));
panel4.add(panel1);
panel4.add(panel2);
panel4.add(panel3);
Agence.getContentPane().add (pan4,BorderLayout.CENTER);
Agence.addWindowListener(new window_listener());
Agence.show();
window.show();
saisie1.setHorizontalAlignment(JTextField.LEFT);
saisie2.setHorizontalAlignment(JTextField.LEFT);
saisie3.setHorizontalAlignment(JTextField.LEFT);
creer.addActionListener(this);
consulter.addActionListener(this);
effacer.addActionListener(this);
quitter.addActionListener(this);
//les evenements des textField
saisie1.addTextListener(new TextListener(){
public textValuechanged(TextEvent e);{
}
autoriserSave();});
saisie2.addTextListener(new TextListener(){
public textValuechanged(TextEvent e);{
}
autoriserSave();});
saisie3.addTextListener(new TextListener(){
public textValuechanged(TextEvent e);{
}
autoriserSave();});
quitter.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e);{
System.exit(0);}});
effacer.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
saisie1.setText("");
saisie2.setText("");
saisie3.setText("");
text.setText(null);
}
});
consulter.addMouseListener(new MouseAdapter(){
public mouseClicked(MouseEvent e){
text.opend("Nom Client : "+saisie1.getText()+"\n"+"Prenom Client : "+ saisie2.getText()+"\n"+"Adresse : "+saisie3.getText());}});
creer.addMouseListener(new MouseAdapter(){
public mouseClicked(MouseEvent e){
enregEcrit("Nom Client : "+saisie1.getText()+"\n"+"Prenom Client : "+ saisie2.getText()+"\n"+"Adresse : "+saisie3.getText());}});
}
//main
public void main(String args[]){
Agence fenetre= new Agence();
}