5 answers
To encrypt a password, I don't know.
To enlarge the window, add before
replace the 300 with the desired size.
the method show();
Otherwise, it's normal that the message "The patient has been created" appears all the time since it's the first instruction you put in actionPerformed(ActionEvent e). So this message appears as soon as you click on a button.
The more it fails, the more chances we have that it works.
To enlarge the window, add before
this.setSize(300,300);
replace the 300 with the desired size.
the method show();
Otherwise, it's normal that the message "The patient has been created" appears all the time since it's the first instruction you put in actionPerformed(ActionEvent e). So this message appears as soon as you click on a button.
The more it fails, the more chances we have that it works.
But try looking at the JPasswordField() for the password. For more info on this component:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JPasswordField.html
It's a component that is placed in a frame.
The more it fails, the more chances we have that it will work.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JPasswordField.html
It's a component that is placed in a frame.
The more it fails, the more chances we have that it will work.
And more precisely, what problem do you have?
It's not easy to understand what you did with your code since some classes are missing (at least the form class) so we can at least try to compile it!
So what have you managed to do?
What can't you do?
The more it fails, the more chances we have that it will work.
It's not easy to understand what you did with your code since some classes are missing (at least the form class) so we can at least try to compile it!
So what have you managed to do?
What can't you do?
The more it fails, the more chances we have that it will work.
Bonjour! C'est encore moi au sujet de mon travail d'école.
Je vous envois ici ce que j'ai fait comme programme pour la Gestion Médicale mais il me semble que j'ai mis beaucoup de choses qui soit ne marchent pas ou soit y son inutiles.
Je ne sais pas comment crypter pour faire un mot de passe à vérifier afin que les employés puissent entrer dans le formulaire d'info. Lorsque l'interface sur le formulaire apparaît on ne voit qu'une mini fenêtre que l'on doit agrandir nous même.
Comment fait-on pour que l'on voit directement bien ouvert sans avoir à l'agrandir? Lorsque je rentre un nouvel emlpoyé le même message m'apparaît 'Le patient a été créé' même si je n'ai rien rentrer. C'est quoi mon ou mes erreurs?
Merci de répondre
public class Adresse
{
private String noMaison, rue, ville, province, pays, codePostal;
public Adresse() { }
public Adresse(String noMaison, String rue, String codePostal)
{
this.noMaison= noMaison;
this.rue= rue;
this.codePostal= codePostal;
}
public Adresse(String noMaison, String rue, String ville, String province, String pays, String codePostal)
{
this.noMaison= noMaison;
this.rue = rue;
this.ville= ville;
this.province= province;
this.pays= pays;
this.codePostal= codePostal;
}
//méthodes GET
public String getNoMaison() { return noMaison; }
public String getRue() { return rue; }
public String getVille() { return ville; }
public String getProvince() { return province; }
public String getPays() { return pays; }
public String getCodePostal() { return codePostal; }
//méthodes SET
public void setNoMaison(String noMaison) { this.noMaison= noMaison; }
public void setRue(String rue) { this.rue= rue; }
public void setVille(String ville) { this.ville= ville; }
public void setProvince(String province) {this.province= province; }
public void setPays(String pays) { this.pays= pays; }
public void setCodePostal(String codePostal) { this.codePostal= codePostal; }
public String toString()
{
return "No. de Maison: " + noMaison + "\n" + "Rue: " + rue + "\n" + "Ville: " + ville + "\n"
+ "Province: " + province + "\n" + "Pays: " + pays + "\n" + "Code Postal: " + codePostal + "\n";
}
}//classe
------------------------------------------------------------------------
//import java.util.*;
import javax.swing.*;
public class Employee extends Personne
{
//private Vector mesEmployee = new Vector();
//private Employee unEmployee;
private int noEmployee;
private String TypePersonnel;
private Personne personne;
public Employee() { }
public Employee(int noEmployee, String TypePersonnel, Personne personne)
{
this.noEmployee = noEmployee;
this.TypePersonnel = TypePersonnel;
this.personne = personne;
}
//méthodes GET
public int getNoEmployee() { return noEmployee; }
public String getTypePersonnel() { return TypePersonnel; }
public Personne getPersonne() { return personne; }//
//***public Vector getVector() { return mesEmployee; }
//méthodes SET
public void setNoEmployee(int noEmployee) { this.noEmployee = noEmployee; }
public void setTypePersonnel(String TypePersonnel) { this.TypePersonnel = TypePersonnel; }
public void setPersonne(Personne personne) { this.personne = personne; }//
public String toString() {
return "Numéro de l'employé : " + "\t\t" + noEmployee + "\n"
+ "Type de personnel : " + "\t\t" + TypePersonnel + "\n";
}
//Obtenir la taille d'un enregistrement
public long tailleEnrg(String typePersonnel, Personne personne) {
long taille=(4 + typePersonnel.length() + personne.toString().length());
return taille;
}
//Obtenir le numero d'enregistrement
public long numeroEnrg(int leNumero) {
int numEnreg = leNumero % 100;
return numEnreg;
}
//Obtenir l'adresse de l'enregistrement
public long adresseEnrg(long numEnreg, long taille) {
long adresseEnrg = numEnreg*taille;
return adresseEnrg;
}
}//fin classe {}
-----------------------------------------------------------------------
import java.awt.*; //JTextArea
import java.awt.event.*;
import java.io.*; //lectureFichier
import javax.swing.*;
import java.util.*;
/*
import java.io.IOException;
import javax.swing.JOptionPane;
import java.awt.Font;
*/
public class Formulaire extends JFrame implements ActionListener
{
ObjectOutputStream laSortie;
String fichierAdm="admin.dat";
String fichierSout="soutien.dat";
final JLabel etiqTypePersonnel, etiqNoEmployee,
etiqNom,
etiqPrenom,
etiqNoMaison, etiqRue, etiqVille, etiqProvince, etiqPays, etiqCodePostal,
etiqDatNais,
etiqSexe,
etiqEtatCivil,
etiqNoTel;
final JTextField champTypePersonnel, champNoEmployee,
champNom,
champPrenom,
champNoMaison, champRue, champVille, champProvince, champPays, champCodePostal,
champDatNais,
champSexe,
champEtatCivil,
champNoTel;
final JButton ajouter, initialiser, supprimer, retourMenuP;
static Vector employees = new Vector();
Adresse adressPers;
Personne personne;
int noEmployee;
int numEmp;
private String noEmp;
String typePers,
nom,
prenom,
noMaison, rue, ville, province, pays, codePostal,
datNais,
sexe,
etatCivil,
noTel;
//int motDePasse;
//String numHouse;
JTextArea sortie = new JTextArea(10,30);
BufferedWriter sortieText;
//constructeur
public Formulaire()
{
super("AJOUT D'UN EMPLOYÉE");
Container c = getContentPane();
c.setLayout(new GridLayout(0, 2, 6, 6));
etiqTypePersonnel = new JLabel("Type de personnel :",SwingConstants.RIGHT);
etiqTypePersonnel.setToolTipText("De quel type de personnel est-il?");
champTypePersonnel = new JTextField();
champTypePersonnel.addActionListener(this);
c.add(etiqTypePersonnel);
c.add(champTypePersonnel);
etiqNom = new JLabel("Nom :",SwingConstants.RIGHT);
etiqNom.setToolTipText("Quel est son nom?");
champNom = new JTextField();
champNom.addActionListener(this);
c.add(etiqNom);
c.add(champNom);
etiqPrenom = new JLabel("Prénom :",SwingConstants.RIGHT);
etiqPrenom.setToolTipText("Quel est son prénom?");
champPrenom = new JTextField();
champPrenom.addActionListener(this);
c.add(etiqPrenom);
c.add(champPrenom);
etiqNoMaison = new JLabel("Numéro de Maison(ou app.) :",SwingConstants.RIGHT);
etiqNoMaison.setToolTipText("Quel est le numéro de Maison (ou app.)?");
champNoMaison = new JTextField();
champNoMaison.addActionListener(this);
c.add(etiqNoMaison);
c.add(champNoMaison);
etiqRue = new JLabel("Rue :",SwingConstants.RIGHT);
etiqRue.setToolTipText("Quel est le nom de la rue?");
champRue = new JTextField();
champRue.addActionListener(this);
c.add(etiqRue);
c.add(champRue);
etiqVille = new JLabel("Ville :",SwingConstants.RIGHT);
etiqVille.setToolTipText("Quel est le nom de la ville?");
champVille = new JTextField();
champVille.addActionListener(this);
c.add(etiqVille);
c.add(champVille);
etiqProvince = new JLabel("Province :",SwingConstants.RIGHT);
etiqProvince.setToolTipText("Quel est le nom de la province?");
champProvince = new JTextField();
champProvince.addActionListener(this);
c.add(etiqProvince);
c.add(champProvince);
etiqPays = new JLabel("Pays :",SwingConstants.RIGHT);
etiqPays.setToolTipText("Quel est le nom du pays?");
champPays = new JTextField();
champPays.addActionListener(this);
c.add(etiqPays);
c.add(champPays);
etiqCodePostal = new JLabel("Code postal :",SwingConstants.RIGHT);
etiqCodePostal.setToolTipText("Quel est son code postal");
champCodePostal = new JTextField();
champCodePostal.addActionListener(this);
c.add(etiqCodePostal);
c.add(champCodePostal);
etiqDatNais = new JLabel("Date de naissance :",SwingConstants.RIGHT);
etiqDatNais.setToolTipText("Quel est sa date de naissance");
champDatNais = new JTextField();
champDatNais.addActionListener(this);
c.add(etiqDatNais);
c.add(champDatNais);
etiqSexe = new JLabel("Type de sexe :",SwingConstants.RIGHT);
etiqSexe.setToolTipText("De quel est sexe est-il (elle)?");
champSexe = new JTextField();
champSexe.addActionListener(this);
c.add(etiqSexe);
c.add(champSexe);
etiqEtatCivil = new JLabel("État civil :",SwingConstants.RIGHT);
etiqEtatCivil.setToolTipText("Quel est son état civil");
champEtatCivil = new JTextField();
champEtatCivil.addActionListener(this);
c.add(etiqEtatCivil);
c.add(champEtatCivil);
etiqNoTel = new JLabel("Téléphone :",SwingConstants.RIGHT);
etiqNoTel.setToolTipText("Quel est son numéro de téléphone");
champNoTel = new JTextField();
c.add(etiqNoTel);
c.add(champNoTel);
//--- NUMÉRO - L'EMPLOYEE immodifiable-----------------------------
etiqNoEmployee = new JLabel("Numéro d'employé:",SwingConstants.RIGHT);
champNoEmployee = new JTextField();
champNoEmployee.setBackground(Color.orange);
champNoEmployee.addActionListener(this);
champNoEmployee.setEditable(false);
noEmp = Integer.toString(employees.size()+1);//private String: noEmp --> vector: employees
noEmployee = employees.size()+1; //int: noEmployee --> vector: employees
champNoEmployee.setText(noEmp); //private String: noEmp est ajouté au Container: c
c.add(etiqNoEmployee);
c.add(champNoEmployee);
ajouter = new JButton("Ajouter l'employé");
ajouter.addActionListener(this);
c.add(ajouter);
initialiser = new JButton("Initialiser");
initialiser.addActionListener(this);
c.add(initialiser);
supprimer = new JButton("Supprimer un employé");
supprimer.addActionListener(this);
c.add(supprimer);
retourMenuP = new JButton("Retour au menu");
retourMenuP.addActionListener(this);
c.add(retourMenuP);
c.setSize(200,200);
c.setLocation(200,200);
show();
}
public void actionPerformed(ActionEvent e)
{
//-------------------------------AJOUTER----------------------------
if(e.getSource() == ajouter)
{
String TypePersonnel = "";
TypePersonnel = champTypePersonnel.getText();
noEmp = Integer.toString(noEmployee); //private String: noEmp == int: noEmployee
noEmp = Integer.toString(employees.size()+1); //private String: noEmp --> vector: employees
noEmployee = employees.size()+1; //int: noEmployee --> vector: employees
champNoEmployee.setText(noEmp); //private String: noEmp est ajouté au Container: c
nom = champNom.getText();
prenom = champPrenom.getText();
noMaison = champNoMaison.getText();
rue = champRue.getText();
ville = champVille.getText();
province = champProvince.getText();
pays = champPays.getText();
codePostal = champCodePostal.getText();
datNais = champDatNais.getText();
sexe = champSexe.getText();
etatCivil = champEtatCivil.getText();
noTel = champNoTel.getText();
//String MOTPASSE = champTypePersonnel.getText();
adressPers = new Adresse(noMaison, rue, ville, province, pays, codePostal);
personne = new Personne(nom, prenom, adressPers, datNais, sexe, etatCivil, noTel); //objet Personne
employees.addElement(new Employee(noEmployee,TypePersonnel,personne));
ecrireFichier(employees);
String texte ="";
for(int i =0;i < employees.size();i++)
{
Employee emp = (Employee)employees.elementAt(i);
texte += emp.toString() + "\n"
+ "Nom du Client : \t\t" + emp.getPersonne().getPrenom() + " "
+ emp.getPersonne().getNom() + "\n"
+ emp.getPersonne().getAdressPers().toString() + "\n"
+ "Date de naissance : \t\t" + emp.getPersonne().getDatNais()+"\n"
+ "Type de sexe : \t\t\t" + emp.getPersonne().getSexe()+"\n"
+ "État civil : \t\t\t" + emp.getPersonne().getEtatCivil()+"\n"
+ "Numéro de téléphone : \t\t" + emp.getPersonne().getNoTel()+"\n" ;
sortie.setText(texte);
}
noEmployee += 1;
noEmp = Integer.toString(noEmployee);
JOptionPane.showMessageDialog(null, sortie, "Information sur l'employé",JOptionPane.PLAIN_MESSAGE);
try {
sortieText.write(texte);
sortieText.newLine();
sortieText.close();
} catch (IOException e2){}
champPays.setText("");
champProvince.setText("");
champVille.setText("");
champPrenom.setText("");
champNom.setText("");
champNoTel.setText("");
champDatNais.setText("");
champSexe.setText("");
champEtatCivil.setText("");
champRue.setText("");
champNoMaison.setText("");
champCodePostal.setText("");
champNoEmployee.setText(noEmp);
champTypePersonnel.setText("");
}
//----------------------------INITIALISER---------------------------
if (e.getSource() == initialiser)
{
champTypePersonnel.setText("");
champNoEmployee.setText(noEmp);
champNom.setText("");
champPrenom.setText("");
champNoMaison.setText("");
champRue.setText("");
champVille.setText("");
champProvince.setText("");
champPays.setText("");
champDatNais.setText("");
champSexe.setText("");
champEtatCivil.setText("");
champNoTel.setText("");
champCodePostal.setText("");
}
//----------------------------SUPPRIMER---------------------------
if(e.getSource() == supprimer)
{
String no = JOptionPane.showInputDialog("Quel est le numéro de l'employée que vous voulez supprimer ?");
numEmp = Integer.parseInt(no);
for(int i =0;i < employees.size();i++) //employees=vector
{
Employee emp = (Employee)employees.elementAt(i);
if(emp.getNoEmployee()== numEmp)
{
employees.removeElementAt(i);
noEmployee -= 1;
noEmp = Integer.toString(noEmployee);
champNoEmployee.setText(noEmp);
}
else
{
JOptionPane.showMessageDialog(null, "Ce numéro d'employé est inexistant!");
}
}//for
}
if(e.getSource() == retourMenuP)
{
GestionMedicale autreGestion= new GestionMedicale();
}
}//actionPerformed
private void ecrireFichier(Object emp)
{
try {
laSortie= new ObjectOutputStream(new FileOutputStream(fichierAdm));
laSortie.writeObject(emp);
laSortie.close();
}
catch(IOException ioe) {
System.out.println("Exception du type IO!");
}
}
}//fin classe
--------------------------------------------------------------------
import java.awt.*; //JTextArea
import java.awt.event.*;
import java.io.*; //lectureFichier
import javax.swing.*;
import java.util.*;
public class FormulaireMedecin extends JFrame implements ActionListener
{
ObjectOutputStream laSortie;
String fichierMed="medical.dat";
final JLabel etiqTypePersonnel, etiqNoEmployee,
etiqNom,
etiqPrenom,
etiqNoMaison, etiqRue, etiqVille, etiqProvince, etiqPays, etiqCodePostal,
etiqDatNais,
etiqSexe,
etiqEtatCivil,
etiqNoTel,
etiqSpecialite;
final JTextField champTypePersonnel, champNoEmployee,
champNom,
champPrenom,
champNoMaison, champRue, champVille, champProvince, champPays, champCodePostal,
champDatNais,
champSexe,
champEtatCivil,
champNoTel,
champSpecialite;
final JButton ajouter, initialiser, supprimer, retourMenuP;
static Vector employees = new Vector();
Adresse adressPers;
Personne personne;
int noEmployee;
int numEmp;
private String noEmp;
String typePers,
nom,
prenom,
noMaison, rue, ville, province, pays, codePostal,
datNais,
sexe,
etatCivil,
noTel;
//int motDePasse;
//String numHouse;
JTextArea sortie = new JTextArea(10,30);
BufferedWriter sortieText;
//constructeur
Je vous envois ici ce que j'ai fait comme programme pour la Gestion Médicale mais il me semble que j'ai mis beaucoup de choses qui soit ne marchent pas ou soit y son inutiles.
Je ne sais pas comment crypter pour faire un mot de passe à vérifier afin que les employés puissent entrer dans le formulaire d'info. Lorsque l'interface sur le formulaire apparaît on ne voit qu'une mini fenêtre que l'on doit agrandir nous même.
Comment fait-on pour que l'on voit directement bien ouvert sans avoir à l'agrandir? Lorsque je rentre un nouvel emlpoyé le même message m'apparaît 'Le patient a été créé' même si je n'ai rien rentrer. C'est quoi mon ou mes erreurs?
Merci de répondre
public class Adresse
{
private String noMaison, rue, ville, province, pays, codePostal;
public Adresse() { }
public Adresse(String noMaison, String rue, String codePostal)
{
this.noMaison= noMaison;
this.rue= rue;
this.codePostal= codePostal;
}
public Adresse(String noMaison, String rue, String ville, String province, String pays, String codePostal)
{
this.noMaison= noMaison;
this.rue = rue;
this.ville= ville;
this.province= province;
this.pays= pays;
this.codePostal= codePostal;
}
//méthodes GET
public String getNoMaison() { return noMaison; }
public String getRue() { return rue; }
public String getVille() { return ville; }
public String getProvince() { return province; }
public String getPays() { return pays; }
public String getCodePostal() { return codePostal; }
//méthodes SET
public void setNoMaison(String noMaison) { this.noMaison= noMaison; }
public void setRue(String rue) { this.rue= rue; }
public void setVille(String ville) { this.ville= ville; }
public void setProvince(String province) {this.province= province; }
public void setPays(String pays) { this.pays= pays; }
public void setCodePostal(String codePostal) { this.codePostal= codePostal; }
public String toString()
{
return "No. de Maison: " + noMaison + "\n" + "Rue: " + rue + "\n" + "Ville: " + ville + "\n"
+ "Province: " + province + "\n" + "Pays: " + pays + "\n" + "Code Postal: " + codePostal + "\n";
}
}//classe
------------------------------------------------------------------------
//import java.util.*;
import javax.swing.*;
public class Employee extends Personne
{
//private Vector mesEmployee = new Vector();
//private Employee unEmployee;
private int noEmployee;
private String TypePersonnel;
private Personne personne;
public Employee() { }
public Employee(int noEmployee, String TypePersonnel, Personne personne)
{
this.noEmployee = noEmployee;
this.TypePersonnel = TypePersonnel;
this.personne = personne;
}
//méthodes GET
public int getNoEmployee() { return noEmployee; }
public String getTypePersonnel() { return TypePersonnel; }
public Personne getPersonne() { return personne; }//
//***public Vector getVector() { return mesEmployee; }
//méthodes SET
public void setNoEmployee(int noEmployee) { this.noEmployee = noEmployee; }
public void setTypePersonnel(String TypePersonnel) { this.TypePersonnel = TypePersonnel; }
public void setPersonne(Personne personne) { this.personne = personne; }//
public String toString() {
return "Numéro de l'employé : " + "\t\t" + noEmployee + "\n"
+ "Type de personnel : " + "\t\t" + TypePersonnel + "\n";
}
//Obtenir la taille d'un enregistrement
public long tailleEnrg(String typePersonnel, Personne personne) {
long taille=(4 + typePersonnel.length() + personne.toString().length());
return taille;
}
//Obtenir le numero d'enregistrement
public long numeroEnrg(int leNumero) {
int numEnreg = leNumero % 100;
return numEnreg;
}
//Obtenir l'adresse de l'enregistrement
public long adresseEnrg(long numEnreg, long taille) {
long adresseEnrg = numEnreg*taille;
return adresseEnrg;
}
}//fin classe {}
-----------------------------------------------------------------------
import java.awt.*; //JTextArea
import java.awt.event.*;
import java.io.*; //lectureFichier
import javax.swing.*;
import java.util.*;
/*
import java.io.IOException;
import javax.swing.JOptionPane;
import java.awt.Font;
*/
public class Formulaire extends JFrame implements ActionListener
{
ObjectOutputStream laSortie;
String fichierAdm="admin.dat";
String fichierSout="soutien.dat";
final JLabel etiqTypePersonnel, etiqNoEmployee,
etiqNom,
etiqPrenom,
etiqNoMaison, etiqRue, etiqVille, etiqProvince, etiqPays, etiqCodePostal,
etiqDatNais,
etiqSexe,
etiqEtatCivil,
etiqNoTel;
final JTextField champTypePersonnel, champNoEmployee,
champNom,
champPrenom,
champNoMaison, champRue, champVille, champProvince, champPays, champCodePostal,
champDatNais,
champSexe,
champEtatCivil,
champNoTel;
final JButton ajouter, initialiser, supprimer, retourMenuP;
static Vector employees = new Vector();
Adresse adressPers;
Personne personne;
int noEmployee;
int numEmp;
private String noEmp;
String typePers,
nom,
prenom,
noMaison, rue, ville, province, pays, codePostal,
datNais,
sexe,
etatCivil,
noTel;
//int motDePasse;
//String numHouse;
JTextArea sortie = new JTextArea(10,30);
BufferedWriter sortieText;
//constructeur
public Formulaire()
{
super("AJOUT D'UN EMPLOYÉE");
Container c = getContentPane();
c.setLayout(new GridLayout(0, 2, 6, 6));
etiqTypePersonnel = new JLabel("Type de personnel :",SwingConstants.RIGHT);
etiqTypePersonnel.setToolTipText("De quel type de personnel est-il?");
champTypePersonnel = new JTextField();
champTypePersonnel.addActionListener(this);
c.add(etiqTypePersonnel);
c.add(champTypePersonnel);
etiqNom = new JLabel("Nom :",SwingConstants.RIGHT);
etiqNom.setToolTipText("Quel est son nom?");
champNom = new JTextField();
champNom.addActionListener(this);
c.add(etiqNom);
c.add(champNom);
etiqPrenom = new JLabel("Prénom :",SwingConstants.RIGHT);
etiqPrenom.setToolTipText("Quel est son prénom?");
champPrenom = new JTextField();
champPrenom.addActionListener(this);
c.add(etiqPrenom);
c.add(champPrenom);
etiqNoMaison = new JLabel("Numéro de Maison(ou app.) :",SwingConstants.RIGHT);
etiqNoMaison.setToolTipText("Quel est le numéro de Maison (ou app.)?");
champNoMaison = new JTextField();
champNoMaison.addActionListener(this);
c.add(etiqNoMaison);
c.add(champNoMaison);
etiqRue = new JLabel("Rue :",SwingConstants.RIGHT);
etiqRue.setToolTipText("Quel est le nom de la rue?");
champRue = new JTextField();
champRue.addActionListener(this);
c.add(etiqRue);
c.add(champRue);
etiqVille = new JLabel("Ville :",SwingConstants.RIGHT);
etiqVille.setToolTipText("Quel est le nom de la ville?");
champVille = new JTextField();
champVille.addActionListener(this);
c.add(etiqVille);
c.add(champVille);
etiqProvince = new JLabel("Province :",SwingConstants.RIGHT);
etiqProvince.setToolTipText("Quel est le nom de la province?");
champProvince = new JTextField();
champProvince.addActionListener(this);
c.add(etiqProvince);
c.add(champProvince);
etiqPays = new JLabel("Pays :",SwingConstants.RIGHT);
etiqPays.setToolTipText("Quel est le nom du pays?");
champPays = new JTextField();
champPays.addActionListener(this);
c.add(etiqPays);
c.add(champPays);
etiqCodePostal = new JLabel("Code postal :",SwingConstants.RIGHT);
etiqCodePostal.setToolTipText("Quel est son code postal");
champCodePostal = new JTextField();
champCodePostal.addActionListener(this);
c.add(etiqCodePostal);
c.add(champCodePostal);
etiqDatNais = new JLabel("Date de naissance :",SwingConstants.RIGHT);
etiqDatNais.setToolTipText("Quel est sa date de naissance");
champDatNais = new JTextField();
champDatNais.addActionListener(this);
c.add(etiqDatNais);
c.add(champDatNais);
etiqSexe = new JLabel("Type de sexe :",SwingConstants.RIGHT);
etiqSexe.setToolTipText("De quel est sexe est-il (elle)?");
champSexe = new JTextField();
champSexe.addActionListener(this);
c.add(etiqSexe);
c.add(champSexe);
etiqEtatCivil = new JLabel("État civil :",SwingConstants.RIGHT);
etiqEtatCivil.setToolTipText("Quel est son état civil");
champEtatCivil = new JTextField();
champEtatCivil.addActionListener(this);
c.add(etiqEtatCivil);
c.add(champEtatCivil);
etiqNoTel = new JLabel("Téléphone :",SwingConstants.RIGHT);
etiqNoTel.setToolTipText("Quel est son numéro de téléphone");
champNoTel = new JTextField();
c.add(etiqNoTel);
c.add(champNoTel);
//--- NUMÉRO - L'EMPLOYEE immodifiable-----------------------------
etiqNoEmployee = new JLabel("Numéro d'employé:",SwingConstants.RIGHT);
champNoEmployee = new JTextField();
champNoEmployee.setBackground(Color.orange);
champNoEmployee.addActionListener(this);
champNoEmployee.setEditable(false);
noEmp = Integer.toString(employees.size()+1);//private String: noEmp --> vector: employees
noEmployee = employees.size()+1; //int: noEmployee --> vector: employees
champNoEmployee.setText(noEmp); //private String: noEmp est ajouté au Container: c
c.add(etiqNoEmployee);
c.add(champNoEmployee);
ajouter = new JButton("Ajouter l'employé");
ajouter.addActionListener(this);
c.add(ajouter);
initialiser = new JButton("Initialiser");
initialiser.addActionListener(this);
c.add(initialiser);
supprimer = new JButton("Supprimer un employé");
supprimer.addActionListener(this);
c.add(supprimer);
retourMenuP = new JButton("Retour au menu");
retourMenuP.addActionListener(this);
c.add(retourMenuP);
c.setSize(200,200);
c.setLocation(200,200);
show();
}
public void actionPerformed(ActionEvent e)
{
//-------------------------------AJOUTER----------------------------
if(e.getSource() == ajouter)
{
String TypePersonnel = "";
TypePersonnel = champTypePersonnel.getText();
noEmp = Integer.toString(noEmployee); //private String: noEmp == int: noEmployee
noEmp = Integer.toString(employees.size()+1); //private String: noEmp --> vector: employees
noEmployee = employees.size()+1; //int: noEmployee --> vector: employees
champNoEmployee.setText(noEmp); //private String: noEmp est ajouté au Container: c
nom = champNom.getText();
prenom = champPrenom.getText();
noMaison = champNoMaison.getText();
rue = champRue.getText();
ville = champVille.getText();
province = champProvince.getText();
pays = champPays.getText();
codePostal = champCodePostal.getText();
datNais = champDatNais.getText();
sexe = champSexe.getText();
etatCivil = champEtatCivil.getText();
noTel = champNoTel.getText();
//String MOTPASSE = champTypePersonnel.getText();
adressPers = new Adresse(noMaison, rue, ville, province, pays, codePostal);
personne = new Personne(nom, prenom, adressPers, datNais, sexe, etatCivil, noTel); //objet Personne
employees.addElement(new Employee(noEmployee,TypePersonnel,personne));
ecrireFichier(employees);
String texte ="";
for(int i =0;i < employees.size();i++)
{
Employee emp = (Employee)employees.elementAt(i);
texte += emp.toString() + "\n"
+ "Nom du Client : \t\t" + emp.getPersonne().getPrenom() + " "
+ emp.getPersonne().getNom() + "\n"
+ emp.getPersonne().getAdressPers().toString() + "\n"
+ "Date de naissance : \t\t" + emp.getPersonne().getDatNais()+"\n"
+ "Type de sexe : \t\t\t" + emp.getPersonne().getSexe()+"\n"
+ "État civil : \t\t\t" + emp.getPersonne().getEtatCivil()+"\n"
+ "Numéro de téléphone : \t\t" + emp.getPersonne().getNoTel()+"\n" ;
sortie.setText(texte);
}
noEmployee += 1;
noEmp = Integer.toString(noEmployee);
JOptionPane.showMessageDialog(null, sortie, "Information sur l'employé",JOptionPane.PLAIN_MESSAGE);
try {
sortieText.write(texte);
sortieText.newLine();
sortieText.close();
} catch (IOException e2){}
champPays.setText("");
champProvince.setText("");
champVille.setText("");
champPrenom.setText("");
champNom.setText("");
champNoTel.setText("");
champDatNais.setText("");
champSexe.setText("");
champEtatCivil.setText("");
champRue.setText("");
champNoMaison.setText("");
champCodePostal.setText("");
champNoEmployee.setText(noEmp);
champTypePersonnel.setText("");
}
//----------------------------INITIALISER---------------------------
if (e.getSource() == initialiser)
{
champTypePersonnel.setText("");
champNoEmployee.setText(noEmp);
champNom.setText("");
champPrenom.setText("");
champNoMaison.setText("");
champRue.setText("");
champVille.setText("");
champProvince.setText("");
champPays.setText("");
champDatNais.setText("");
champSexe.setText("");
champEtatCivil.setText("");
champNoTel.setText("");
champCodePostal.setText("");
}
//----------------------------SUPPRIMER---------------------------
if(e.getSource() == supprimer)
{
String no = JOptionPane.showInputDialog("Quel est le numéro de l'employée que vous voulez supprimer ?");
numEmp = Integer.parseInt(no);
for(int i =0;i < employees.size();i++) //employees=vector
{
Employee emp = (Employee)employees.elementAt(i);
if(emp.getNoEmployee()== numEmp)
{
employees.removeElementAt(i);
noEmployee -= 1;
noEmp = Integer.toString(noEmployee);
champNoEmployee.setText(noEmp);
}
else
{
JOptionPane.showMessageDialog(null, "Ce numéro d'employé est inexistant!");
}
}//for
}
if(e.getSource() == retourMenuP)
{
GestionMedicale autreGestion= new GestionMedicale();
}
}//actionPerformed
private void ecrireFichier(Object emp)
{
try {
laSortie= new ObjectOutputStream(new FileOutputStream(fichierAdm));
laSortie.writeObject(emp);
laSortie.close();
}
catch(IOException ioe) {
System.out.println("Exception du type IO!");
}
}
}//fin classe
--------------------------------------------------------------------
import java.awt.*; //JTextArea
import java.awt.event.*;
import java.io.*; //lectureFichier
import javax.swing.*;
import java.util.*;
public class FormulaireMedecin extends JFrame implements ActionListener
{
ObjectOutputStream laSortie;
String fichierMed="medical.dat";
final JLabel etiqTypePersonnel, etiqNoEmployee,
etiqNom,
etiqPrenom,
etiqNoMaison, etiqRue, etiqVille, etiqProvince, etiqPays, etiqCodePostal,
etiqDatNais,
etiqSexe,
etiqEtatCivil,
etiqNoTel,
etiqSpecialite;
final JTextField champTypePersonnel, champNoEmployee,
champNom,
champPrenom,
champNoMaison, champRue, champVille, champProvince, champPays, champCodePostal,
champDatNais,
champSexe,
champEtatCivil,
champNoTel,
champSpecialite;
final JButton ajouter, initialiser, supprimer, retourMenuP;
static Vector employees = new Vector();
Adresse adressPers;
Personne personne;
int noEmployee;
int numEmp;
private String noEmp;
String typePers,
nom,
prenom,
noMaison, rue, ville, province, pays, codePostal,
datNais,
sexe,
etatCivil,
noTel;
//int motDePasse;
//String numHouse;
JTextArea sortie = new JTextArea(10,30);
BufferedWriter sortieText;
//constructeur
Hey,
just a detail about JPasswordField: it does not encrypt the password in any way. It only masks the display. If you want to encrypt it for storage, use MD5 as the algorithm.
++
Nico
just a detail about JPasswordField: it does not encrypt the password in any way. It only masks the display. If you want to encrypt it for storage, use MD5 as the algorithm.
++
Nico
Hello friends,
I need to create a Java program that implements a graphical user interface, which should manage patient appointments for 3 different specialist doctors over a two-week period.
The appointments must take into account the doctors' availability, the urgency of the patient, and their preferences for the appointment.
For example, if a patient does not specify a preference for an appointment, the program should be able to assign an appointment based on the established schedule shown as a JTable displaying each doctor's time calendar.
The program should also manage canceled appointments, meaning it should remove an appointment from the time schedule and display it again.
In short, I would like to have, please, some ideas that can help me get started with coding.
Thank you in advance for your valuable advice.
I need to create a Java program that implements a graphical user interface, which should manage patient appointments for 3 different specialist doctors over a two-week period.
The appointments must take into account the doctors' availability, the urgency of the patient, and their preferences for the appointment.
For example, if a patient does not specify a preference for an appointment, the program should be able to assign an appointment based on the established schedule shown as a JTable displaying each doctor's time calendar.
The program should also manage canceled appointments, meaning it should remove an appointment from the time schedule and display it again.
In short, I would like to have, please, some ideas that can help me get started with coding.
Thank you in advance for your valuable advice.
Do not forget the checks for healthcare service codes provided. For 6-digit codes, in Belgium, it's Modulo7; for bank codes it's Modulo97. Be careful with patients using third-party payment (co-payment).
I hope I have helped you.
Could you contact me, I also have questions. Thank you in advance.
goossens.thierry@gmail.com
I hope I have helped you.
Could you contact me, I also have questions. Thank you in advance.
goossens.thierry@gmail.com