MAJ-2
This commit is contained in:
48
vue/Connexion.java
Normal file
48
vue/Connexion.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package vue;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Image;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
public class Connexion extends JFrame
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 370051638025645700L;
|
||||
|
||||
public Connexion()
|
||||
{
|
||||
this.setIconImage(new ImageIcon("src/images//favicon.png").getImage());//logo fenetre
|
||||
this.setTitle("Ecurie");//titre fenetre
|
||||
this.setBounds(400, 300, 500, 300);//format fenetre
|
||||
this.getContentPane().setBackground(new Color(247,245,226));//Couleur fenetre RGB
|
||||
|
||||
|
||||
this.setLayout(null); // pas de grille
|
||||
this.setResizable(false); // la fen<65>tre ne pourra pas <20>tre redimensionn<6E>e
|
||||
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
|
||||
ImageIcon logo = new ImageIcon(new ImageIcon("src/images/logo.png").getImage().getScaledInstance(500, 100, Image.SCALE_DEFAULT));//logo page L/l
|
||||
JLabel lbLogo = new JLabel(logo);
|
||||
lbLogo.setBounds(170, 10, 350, 100);//position logo page GuaucheBasLargeurHauteur
|
||||
this.add(lbLogo);
|
||||
JLabel lbTitre = new JLabel("Connexion");//titre page
|
||||
lbTitre.setBounds(170, 10, 350, 50);// position titre page
|
||||
lbTitre.setFont(new Font(lbTitre.getText(), Font.CENTER_BASELINE, 20));// taille titre page
|
||||
this.add(lbTitre);
|
||||
|
||||
this.add(new VueConnexion());//insertion VueConnexion
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public void rendreVisible(boolean val)
|
||||
{
|
||||
this.setVisible(val);
|
||||
}
|
||||
}
|
||||
174
vue/Formulaire/FormChevaux.java
Normal file
174
vue/Formulaire/FormChevaux.java
Normal file
@@ -0,0 +1,174 @@
|
||||
package vue.Formulaire;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextField;
|
||||
import controleur.Cheval;
|
||||
import modele.ModeleCheval;
|
||||
|
||||
public class FormChevaux extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = -2223951904837426516L;
|
||||
String[] formState = { "VISUALISER", "AJOUTER", "SUPPRIMER" };
|
||||
String id, nom, sexe, robe, type, race, proprietaire, age, imagecheval = "";
|
||||
int selection;
|
||||
private JComboBox choiceForm = new JComboBox(formState);
|
||||
private JLabel txtId = new JLabel();
|
||||
private JTextField txtNom = new JTextField("");
|
||||
private ButtonGroup groupSexe = new ButtonGroup();
|
||||
private JRadioButton txtSexeF = new JRadioButton("Femelle");
|
||||
private JRadioButton txtSexeH = new JRadioButton("M<EFBFBD>le");
|
||||
private JTextField txtRobe = new JTextField();
|
||||
private JTextField txtType = new JTextField("");
|
||||
private JTextField txtRace = new JTextField("");
|
||||
private JTextField txtProprietaire = new JTextField("");
|
||||
private JTextField txtAge = new JTextField("");
|
||||
//IMG Cheval
|
||||
private JButton btAnnuler = new JButton("Annuler");
|
||||
private JButton btAjouter = new JButton("Editer");
|
||||
public FormChevaux()
|
||||
{
|
||||
//Configuration des composants
|
||||
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");
|
||||
this.setBounds(50, 80, 650, 250);this.setLayout(new GridLayout(0, 2));this.setBackground(new Color(222,220,203));
|
||||
JLabel lbId = new JLabel(" ID :");lbId.setFont(new Font(lbId.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbNom = new JLabel(" Nom :");lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbSexe = new JLabel(" Sexe :");lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
|
||||
txtSexeF.setMnemonic(KeyEvent.VK_B);txtSexeH.setMnemonic(KeyEvent.VK_B);
|
||||
txtSexeF.setActionCommand("FEMELLE");txtSexeH.setActionCommand("MALE");txtSexeF.setSelected(true);
|
||||
JLabel lbRobe = new JLabel(" Robe :");lbRobe.setFont(new Font(lbRobe.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbType = new JLabel(" Type :");lbType.setFont(new Font(lbType.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbRace = new JLabel(" Race :");lbRace.setFont(new Font(lbRace.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbProprietaire = new JLabel(" Proprietaire :");lbProprietaire.setFont(new Font(lbProprietaire.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbAge = new JLabel(" <20>ge :");lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
|
||||
choiceForm.setSelectedIndex(0);choiceForm.addActionListener(this);
|
||||
//IMG Cheval
|
||||
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));this.btAnnuler.addActionListener(this);
|
||||
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));this.btAjouter.addActionListener(this);
|
||||
// Affichage des composants
|
||||
this.add(lbId); this.add(this.txtId);
|
||||
this.add(lbNom); this.add(this.txtNom);
|
||||
this.add(lbSexe); this.add(this.txtSexeF);
|
||||
this.add(lbVide1); this.add(this.txtSexeH);
|
||||
groupSexe.add(txtSexeF); groupSexe.add(txtSexeH);
|
||||
this.add(lbRobe); this.add(this.txtRobe);
|
||||
this.add(lbType); this.add(this.txtType);
|
||||
this.add(lbRace); this.add(this.txtRace);
|
||||
this.add(lbProprietaire); this.add(this.txtProprietaire);
|
||||
this.add(lbAge); this.add(this.txtAge);
|
||||
this.add(this.choiceForm); this.add(lbVide2);
|
||||
this.add(this.btAnnuler); this.add(this.btAjouter);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
|
||||
if(e.getSource()==this.btAnnuler){
|
||||
this.txtId.setText("");
|
||||
this.txtNom.setText("");this.txtNom.setBackground(Color.WHITE);
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtRobe.setText("");this.txtRobe.setBackground(Color.WHITE);
|
||||
this.txtType.setText("");this.txtType.setBackground(Color.WHITE);
|
||||
this.txtRace.setText("");this.txtRace.setBackground(Color.WHITE);
|
||||
this.txtProprietaire.setText("");this.txtProprietaire.setBackground(Color.WHITE);
|
||||
this.txtAge.setText("");this.txtAge.setBackground(Color.WHITE);
|
||||
//IMG Cheval
|
||||
}
|
||||
else if (e.getSource()==this.btAjouter) {
|
||||
int selection = choiceForm.getSelectedIndex();
|
||||
switch(selection) {
|
||||
case 0: //VISUALISE
|
||||
{
|
||||
Cheval unCheval = ModeleCheval.selectWhere(txtNom.getText());
|
||||
if(unCheval == null) {
|
||||
this.txtNom.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez v<>rifier le nom du cheval !");
|
||||
}
|
||||
else {
|
||||
this.txtNom.setBackground(Color.WHITE);
|
||||
this.txtId.setText(String.valueOf(unCheval.getId()));
|
||||
this.txtNom.setText(unCheval.getNom());
|
||||
this.txtSexeF.setSelected(true);//A VERIFIER
|
||||
this.txtRobe.setText(String.valueOf(unCheval.getRobe()));
|
||||
this.txtType.setText(unCheval.getType());
|
||||
this.txtRace.setText(unCheval.getRace());
|
||||
this.txtProprietaire.setText(unCheval.getProprietaire());
|
||||
this.txtAge.setText(String.valueOf(unCheval.getAge()));
|
||||
//image
|
||||
JOptionPane.showMessageDialog(this, "Visualisation reussie");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1://AJOUTER
|
||||
try{
|
||||
this.txtNom.getText();
|
||||
if((txtNom.getText().equals(""))||(txtRobe.getText().equals(""))||(txtType.getText().equals(""))||(txtRace.getText().equals(""))||(txtProprietaire.getText().equals(""))||(txtAge.getText().equals("")))
|
||||
{
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir toutes les valeurs dans les champs vide");
|
||||
this.txtNom.setBackground(Color.RED);
|
||||
this.txtRobe.setBackground(Color.RED);
|
||||
this.txtType.setBackground(Color.RED);
|
||||
this.txtRace.setBackground(Color.RED);
|
||||
this.txtProprietaire.setBackground(Color.RED);
|
||||
this.txtAge.setBackground(Color.RED);
|
||||
}
|
||||
else {
|
||||
this.txtNom.setBackground(Color.WHITE);
|
||||
Cheval unCheval = new Cheval(txtNom.getText(), txtSexeF.getText(), txtRobe.getText(), txtType.getText(), txtRace.getText(), txtProprietaire.getText(), Integer.parseInt(txtAge.getText()));
|
||||
ModeleCheval.insert(unCheval);
|
||||
JOptionPane.showMessageDialog(this, "Insertion reussie");
|
||||
this.txtNom.setText("");
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtRobe.setText("");
|
||||
this.txtType.setText("");
|
||||
this.txtRace.setText("");
|
||||
this.txtProprietaire.setText("");
|
||||
this.txtAge.setText("");
|
||||
}
|
||||
this.setVisible(true); // fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp)
|
||||
{
|
||||
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
|
||||
}
|
||||
break;
|
||||
case 2://DELETE
|
||||
try {
|
||||
if(txtNom.getText().equals("")) {
|
||||
this.txtNom.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs vide");
|
||||
}
|
||||
else {
|
||||
this.txtNom.setBackground(Color.WHITE);
|
||||
ModeleCheval.delete(txtNom.getText());
|
||||
JOptionPane.showMessageDialog(this, "Suppression reussie");
|
||||
this.txtNom.setText("");
|
||||
}
|
||||
this.setVisible(true);// fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp) {
|
||||
this.txtNom.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
class StateListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.out.println("source : " + ((JRadioButton)e.getSource()).getText() + " - <20>tat : " + ((JRadioButton)e.getSource()).isSelected());
|
||||
}
|
||||
}
|
||||
}
|
||||
35
vue/Formulaire/FormCours.java
Normal file
35
vue/Formulaire/FormCours.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package vue.Formulaire;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
import controleur.Cours;
|
||||
|
||||
public class FormCours extends JPanel
|
||||
{
|
||||
private static final long serialVersionUID = 3315083316143792281L;
|
||||
public FormCours()
|
||||
{
|
||||
this.setBounds(30, 80, 720, 330);
|
||||
this.setBackground(new Color(222,220,203));
|
||||
this.setLayout(null);
|
||||
JLabel lbCours = new JLabel("Votre Profil");
|
||||
lbCours.setBounds(350, 5, 300, 50);
|
||||
lbCours.setFont(new Font(lbCours.getText(), Font.CENTER_BASELINE + Font.BOLD, 20));
|
||||
this.add(lbCours);
|
||||
JTextArea txtTitre = new JTextArea();
|
||||
txtTitre.setBounds(20, 50, 300, 400);
|
||||
//txtTitre.setBounds(x, y, width, height);
|
||||
txtTitre.setEditable(false);
|
||||
txtTitre.setBackground(new Color(222,220,203));
|
||||
txtTitre.setFont(new Font(txtTitre.getText(), Font.PLAIN, 20));
|
||||
// txtTitre.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
|
||||
txtTitre.setText( "\n Date : A");
|
||||
this.add(txtTitre);
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
217
vue/Formulaire/FormEleves.java
Normal file
217
vue/Formulaire/FormEleves.java
Normal file
@@ -0,0 +1,217 @@
|
||||
package vue.Formulaire;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextField;
|
||||
import controleur.Eleve;
|
||||
import modele.ModeleEleve;
|
||||
|
||||
public class FormEleves extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 2192831696580913888L;
|
||||
String[] formState = { "VISUALISER", "AJOUTER", "MODIFIER", "SUPPRIMER" };
|
||||
String record, pseudo, prenom, nom, sexe, adresse, mdp, mail, imageeleve;
|
||||
int id, privilege, age, galop, selection;
|
||||
private JComboBox choiceForm = new JComboBox(formState);
|
||||
private JLabel txtId = new JLabel();
|
||||
private JLabel txtPrivilege = new JLabel();
|
||||
private JLabel txtRecord = new JLabel();
|
||||
private JLabel txtPseudo = new JLabel();
|
||||
private JTextField txtPrenom = new JTextField();
|
||||
private JTextField txtNom = new JTextField();
|
||||
private ButtonGroup groupSexe = new ButtonGroup();
|
||||
private JRadioButton txtSexeF = new JRadioButton("Femme");
|
||||
private JRadioButton txtSexeH = new JRadioButton("Homme");
|
||||
private JTextField txtAge = new JTextField();
|
||||
private JTextField txtAdresse = new JTextField();
|
||||
private JLabel txtMdp = new JLabel();
|
||||
private JTextField txtMail = new JTextField();
|
||||
private JTextField txtGalop = new JTextField();
|
||||
//IMG Eleve
|
||||
private JButton btAnnuler = new JButton("Annuler");
|
||||
private JButton btAjouter = new JButton("Editer");
|
||||
public FormEleves()
|
||||
{
|
||||
//Configuration des composants
|
||||
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");
|
||||
this.setBounds(50, 80, 650, 250);this.setLayout(new GridLayout(0, 2));this.setBackground(new Color(222,220,203));
|
||||
JLabel lbId = new JLabel(" ID :");lbId.setFont(new Font(lbId.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbPrivilege = new JLabel(" Privilege :");lbPrivilege.setFont(new Font(lbPrivilege.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbRecord = new JLabel(" Enregistr<74> le :");lbRecord.setFont(new Font(lbRecord.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbPseudo = new JLabel(" Pseudo :");lbPseudo.setFont(new Font(lbPseudo.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbPrenom = new JLabel(" Prenom :");lbPrenom.setFont(new Font(lbPrenom.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbNom = new JLabel(" Nom :");lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbSexe = new JLabel(" Sexe :");lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
|
||||
txtSexeF.setMnemonic(KeyEvent.VK_B);txtSexeF.setActionCommand("FEMME");txtSexeF.setSelected(true);
|
||||
txtSexeH.setMnemonic(KeyEvent.VK_B);txtSexeH.setActionCommand("HOMME");
|
||||
groupSexe.add(txtSexeF);groupSexe.add(txtSexeH);
|
||||
JLabel lbAge = new JLabel(" <20>ge :");lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbAdresse = new JLabel(" Adresse :");lbAdresse.setFont(new Font(lbAdresse.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbMdp = new JLabel(" Mot de Passe :");lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbMail = new JLabel(" E-mail :");lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbGalop = new JLabel(" Galop :");lbGalop.setFont(new Font(lbGalop.getText(), Font.CENTER_BASELINE, 18));
|
||||
choiceForm.setSelectedIndex(0);choiceForm.addActionListener(this);
|
||||
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));this.btAnnuler.addActionListener(this);
|
||||
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));this.btAjouter.addActionListener(this);
|
||||
// Affichage des composants
|
||||
this.add(lbId); this.add(this.txtId);
|
||||
this.add(lbPrivilege); this.add(this.txtPrivilege);
|
||||
this.add(lbRecord); this.add(this.txtRecord);
|
||||
this.add(lbPseudo); this.add(this.txtPseudo);
|
||||
this.add(lbMail); this.add(this.txtMail);
|
||||
this.add(lbMdp); this.add(this.txtMdp);
|
||||
this.add(lbPrenom); this.add(this.txtPrenom);
|
||||
this.add(lbNom); this.add(this.txtNom);
|
||||
this.add(lbSexe); this.add(this.txtSexeF);
|
||||
this.add(lbVide1); this.add(this.txtSexeH);
|
||||
this.add(lbAge); this.add(this.txtAge);
|
||||
this.add(lbAdresse); this.add(this.txtAdresse);
|
||||
this.add(lbGalop); this.add(this.txtGalop);
|
||||
this.add(this.choiceForm); this.add(lbVide2);
|
||||
this.add(this.btAnnuler); this.add(this.btAjouter);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
|
||||
if(e.getSource()==this.btAnnuler) {
|
||||
this.txtId.setText("");
|
||||
this.txtPrivilege.setText("");
|
||||
this.txtRecord.setText("");
|
||||
this.txtPseudo.setText("");
|
||||
this.txtPrenom.setText("");this.txtPrenom.setBackground(Color.WHITE);
|
||||
this.txtNom.setText("");this.txtNom.setBackground(Color.WHITE);
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtAge.setText("");this.txtAge.setBackground(Color.WHITE);
|
||||
this.txtAdresse.setText("");this.txtAdresse.setBackground(Color.WHITE);
|
||||
this.txtMdp.setText("");
|
||||
this.txtMail.setText("");this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtGalop.setText("");this.txtGalop.setBackground(Color.WHITE);
|
||||
}
|
||||
else if (e.getSource()==this.btAjouter) {
|
||||
selection = choiceForm.getSelectedIndex();
|
||||
switch(selection) {
|
||||
case 0: //VISUALISE
|
||||
{
|
||||
Eleve unEleve = ModeleEleve.selectWhere(txtMail.getText());
|
||||
if(unEleve == null) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez v<>rifier l'adresse Email !");
|
||||
}
|
||||
else {
|
||||
this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtId.setText(String.valueOf(unEleve.getId()));
|
||||
this.txtPrivilege.setText(String.valueOf(unEleve.getPrivilege()));
|
||||
this.txtRecord.setText(unEleve.getRecord());
|
||||
this.txtPseudo.setText(unEleve.getPseudo());
|
||||
this.txtPrenom.setText(unEleve.getPrenom());
|
||||
this.txtNom.setText(unEleve.getNom());
|
||||
if (sexe=="FEMME"){this.txtSexeF.setSelected(true);}
|
||||
if (sexe=="HOMME"){this.txtSexeH.setSelected(true);}
|
||||
this.txtAge.setText(String.valueOf(unEleve.getAge()));
|
||||
this.txtAdresse.setText(unEleve.getAdresse());
|
||||
this.txtMdp.setText(unEleve.getMdp());
|
||||
//mail
|
||||
this.txtGalop.setText(String.valueOf(unEleve.getGalop()));
|
||||
//image
|
||||
JOptionPane.showMessageDialog(this, "Visualisation reussie");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1://AJOUTER
|
||||
try{
|
||||
this.txtMail.getText();
|
||||
if((txtNom.getText().equals(""))||(txtSexeF.getText().equals(""))||(txtAge.getText().equals(""))||(txtAdresse.getText().equals(""))||(txtMail.getText().equals(""))||(txtGalop.getText().equals("")))
|
||||
{
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir toutes les valeurs dans les champs vide");
|
||||
this.txtPrenom.setBackground(Color.RED);
|
||||
this.txtNom.setBackground(Color.RED);
|
||||
this.txtAge.setBackground(Color.RED);
|
||||
this.txtAdresse.setBackground(Color.RED);
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
this.txtGalop.setBackground(Color.RED);
|
||||
}
|
||||
else {
|
||||
this.txtMail.setBackground(Color.WHITE);
|
||||
Eleve unEleve = new Eleve(txtPrenom.getText(), txtNom.getText(), txtSexeF.getText(), Integer.parseInt(txtAge.getText()), txtAdresse.getText(), txtMail.getText(), Integer.parseInt(txtGalop.getText()));
|
||||
ModeleEleve.insert(unEleve);
|
||||
JOptionPane.showMessageDialog(this, "Insertion reussie");
|
||||
this.txtPrenom.setText("");
|
||||
this.txtNom.setText("");
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtAge.setText("");
|
||||
this.txtAdresse.setText("");
|
||||
this.txtMail.setText("");
|
||||
this.txtGalop.setText("");
|
||||
}
|
||||
this.setVisible(true); // fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp)
|
||||
{
|
||||
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
|
||||
}
|
||||
break;
|
||||
case 2://MODIFIER
|
||||
try{
|
||||
System.out.println("MODIFY");
|
||||
if(txtMail.getText().equals("")) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs vide");
|
||||
}
|
||||
else {
|
||||
this.txtMail.setBackground(Color.WHITE);
|
||||
Eleve unEleve = new Eleve(txtPrenom.getText(), txtNom.getText(), txtSexeF.getText(), Integer.parseInt(txtAge.getText()), txtAdresse.getText(), txtMail.getText(), Integer.parseInt(txtGalop.getText()));
|
||||
ModeleEleve.update(unEleve, txtMail.getText());
|
||||
JOptionPane.showMessageDialog(this, "Modification reussie");
|
||||
this.txtPrenom.setText("");
|
||||
this.txtNom.setText("");
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtAge.setText("");
|
||||
this.txtAdresse.setText("");
|
||||
this.txtMail.setText("");this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtGalop.setText("");
|
||||
}
|
||||
this.setVisible(true); // fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp) {
|
||||
}
|
||||
break;
|
||||
case 3://SUPPRIMER
|
||||
try {
|
||||
if(txtMail.getText().equals("")) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs vide");
|
||||
}
|
||||
else {
|
||||
ModeleEleve.delete(txtMail.getText());
|
||||
JOptionPane.showMessageDialog(this, "Suppression reussie");
|
||||
this.txtMail.setText("");
|
||||
}
|
||||
this.setVisible(true);// fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
class StateListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.out.println("source : " + ((JRadioButton)e.getSource()).getText() + " - <20>tat : " + ((JRadioButton)e.getSource()).isSelected());
|
||||
}
|
||||
}
|
||||
}
|
||||
189
vue/Formulaire/FormFormateurs.java
Normal file
189
vue/Formulaire/FormFormateurs.java
Normal file
@@ -0,0 +1,189 @@
|
||||
package vue.Formulaire;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextField;
|
||||
import controleur.Formateur;
|
||||
import modele.ModeleFormateur;
|
||||
|
||||
public class FormFormateurs extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = -7023992128997426855L;
|
||||
String[] formState = { "VISUALISER", "AJOUTER", "SUPPRIMER" };
|
||||
String login, prenom, nom, sexe, mail, mdp= "";
|
||||
int id, privilege, age, galop, selection;
|
||||
private JComboBox choiceForm = new JComboBox(formState);
|
||||
private JLabel txtId = new JLabel();
|
||||
private JLabel txtLogin = new JLabel();
|
||||
private JLabel txtPrivilege = new JLabel();
|
||||
private JTextField txtPrenom = new JTextField();
|
||||
private JTextField txtNom = new JTextField("");
|
||||
private JTextField txtAge = new JTextField("");
|
||||
private JTextField txtGalop = new JTextField("");
|
||||
private ButtonGroup groupSexe = new ButtonGroup();
|
||||
private JRadioButton txtSexeF = new JRadioButton("Femme");
|
||||
private JRadioButton txtSexeH = new JRadioButton("Homme");
|
||||
private JTextField txtMail = new JTextField("");
|
||||
private JPasswordField txtMdp = new JPasswordField("");
|
||||
private JButton btAnnuler = new JButton("Annuler");
|
||||
private JButton btAjouter = new JButton("Editer");
|
||||
|
||||
public FormFormateurs()
|
||||
{
|
||||
//Configuration des composants
|
||||
JLabel lbVide1 = new JLabel("");JLabel lbVide2 = new JLabel("");JLabel lbVide3 = new JLabel("");JLabel lbVide4 = new JLabel("");
|
||||
this.setBounds(50, 80, 650, 250);this.setLayout(new GridLayout(0, 2));this.setBackground(new Color(222,220,203));
|
||||
JLabel lbId = new JLabel(" ID :");lbId.setFont(new Font(lbId.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbPrivilege = new JLabel(" Privilege :");lbPrivilege.setFont(new Font(lbPrivilege.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbLogin = new JLabel(" Login :");lbLogin.setFont(new Font(lbLogin.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbPrenom = new JLabel(" Prenom :");lbPrenom.setFont(new Font(lbPrenom.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbNom = new JLabel(" Nom :");lbNom.setFont(new Font(lbNom.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbAge = new JLabel(" <20>ge :");lbAge.setFont(new Font(lbAge.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbGalop = new JLabel(" Galop :");lbGalop.setFont(new Font(lbGalop.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbSexe = new JLabel(" Sexe :");lbSexe.setFont(new Font(lbSexe.getText(), Font.CENTER_BASELINE, 18));
|
||||
txtSexeF.setMnemonic(KeyEvent.VK_B); txtSexeH.setMnemonic(KeyEvent.VK_B);
|
||||
txtSexeF.setActionCommand("FEMME");txtSexeF.setSelected(true); txtSexeH.setActionCommand("HOMME");
|
||||
groupSexe.add(txtSexeF); groupSexe.add(txtSexeH);
|
||||
JLabel lbMail = new JLabel(" E-mail :");lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 18));
|
||||
JLabel lbMdp = new JLabel(" Mot de passe :");lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 18));
|
||||
choiceForm.setSelectedIndex(0);choiceForm.addActionListener(this);
|
||||
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));this.btAnnuler.addActionListener(this);
|
||||
this.btAjouter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));this.btAjouter.addActionListener(this);
|
||||
// Affichage des composants
|
||||
this.add(lbId);this.add(this.txtId);
|
||||
this.add(lbPrivilege);this.add(this.txtPrivilege);
|
||||
this.add(lbLogin);this.add(this.txtLogin);
|
||||
this.add(lbMail);this.add(this.txtMail);
|
||||
this.add(lbMdp);this.add(this.txtMdp);
|
||||
this.add(lbPrenom);this.add(this.txtPrenom);
|
||||
this.add(lbNom);this.add(this.txtNom);
|
||||
this.add(lbAge);this.add(this.txtAge);
|
||||
this.add(lbGalop);this.add(this.txtGalop);
|
||||
this.add(lbSexe);this.add(this.txtSexeF);
|
||||
this.add(lbVide1);this.add(this.txtSexeH);
|
||||
this.add(this.choiceForm);this.add(lbVide2);
|
||||
this.add(this.btAnnuler);this.add(this.btAjouter);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// TODO Stub de la m<>thode g<>n<EFBFBD>r<EFBFBD> automatiquement
|
||||
if(e.getSource()==this.btAnnuler) {
|
||||
this.txtId.setText("");
|
||||
this.txtLogin.setText("");
|
||||
this.txtPrivilege.setText("");
|
||||
this.txtPrenom.setText("");this.txtPrenom.setBackground(Color.WHITE);
|
||||
this.txtNom.setText("");this.txtNom.setBackground(Color.WHITE);
|
||||
this.txtAge.setText("");this.txtAge.setBackground(Color.WHITE);
|
||||
this.txtGalop.setText("");this.txtGalop.setBackground(Color.WHITE);
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtMail.setText("");this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtMdp.setText("");this.txtMdp.setBackground(Color.WHITE);
|
||||
}
|
||||
else if (e.getSource()==this.btAjouter) {
|
||||
int selection = choiceForm.getSelectedIndex();
|
||||
switch(selection) {
|
||||
case 0: //VISUALISE
|
||||
{
|
||||
Formateur unFormateur = ModeleFormateur.selectWhere(txtMail.getText(),String.valueOf(txtMdp.getPassword()));
|
||||
if(unFormateur == null) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
this.txtMdp.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez v<>rifier l'adresse Email et le Mot de passe!");
|
||||
}
|
||||
else {
|
||||
this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtMdp.setBackground(Color.WHITE);
|
||||
this.txtId.setText(String.valueOf(unFormateur.getId()));
|
||||
this.txtPrivilege.setText(String.valueOf(unFormateur.getPrivilege()));
|
||||
this.txtLogin.setText(unFormateur.getLogin());
|
||||
this.txtPrenom.setText(unFormateur.getPrenom());
|
||||
this.txtNom.setText(unFormateur.getNom());
|
||||
this.txtAge.setText(String.valueOf(unFormateur.getAge()));
|
||||
this.txtGalop.setText(String.valueOf(unFormateur.getGalop()));
|
||||
this.txtSexeF.setSelected(true);//A VERIFIER
|
||||
this.txtMdp.setText(unFormateur.getMdp());
|
||||
//mail
|
||||
JOptionPane.showMessageDialog(this, "Visualisation reussie");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1://AJOUTER
|
||||
try{
|
||||
this.txtMail.getText();
|
||||
if((txtNom.getText().equals(""))||(txtSexeF.getText().equals(""))||(txtAge.getText().equals(""))||(txtMail.getText().equals(""))||(txtGalop.getText().equals(""))||(String.valueOf(txtMdp.getPassword()).equals("")))
|
||||
{
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir toutes les valeurs dans les champs vide");
|
||||
this.txtPrenom.setBackground(Color.RED);
|
||||
this.txtNom.setBackground(Color.RED);
|
||||
this.txtAge.setBackground(Color.RED);
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
this.txtGalop.setBackground(Color.RED);
|
||||
this.txtMdp.setBackground(Color.RED);
|
||||
}
|
||||
else {
|
||||
this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtMdp.setBackground(Color.WHITE);
|
||||
Formateur unFormateur = new Formateur(txtPrenom.getText(), txtNom.getText(), Integer.parseInt(txtAge.getText()), Integer.parseInt(txtGalop.getText()),txtSexeF.getText(), txtMail.getText(), String.valueOf(txtMdp.getPassword()));
|
||||
ModeleFormateur.insert(unFormateur);
|
||||
JOptionPane.showMessageDialog(this, "Insertion reussie");
|
||||
this.txtPrenom.setText("");
|
||||
this.txtNom.setText("");
|
||||
this.txtSexeF.setSelected(true);
|
||||
this.txtAge.setText("");
|
||||
this.txtMail.setText("");
|
||||
this.txtGalop.setText("");
|
||||
this.txtMdp.setText("");
|
||||
}
|
||||
this.setVisible(true);// fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp)
|
||||
{
|
||||
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
|
||||
}
|
||||
break;
|
||||
case 2://DELETE
|
||||
try {
|
||||
if(txtMail.getText().equals("") && String.valueOf(txtMdp.getPassword()).equals("")) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
this.txtMdp.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this, "Veuillez saisir des valeurs dans les champs vide");
|
||||
}
|
||||
else {
|
||||
this.txtMail.setBackground(Color.WHITE);
|
||||
this.txtMdp.setBackground(Color.WHITE);
|
||||
ModeleFormateur.delete(txtMail.getText());
|
||||
JOptionPane.showMessageDialog(this, "Suppression reussie");
|
||||
this.txtMail.setText("");
|
||||
this.txtMdp.setText("");
|
||||
}
|
||||
this.setVisible(true);// fin d'enregistrement
|
||||
}
|
||||
catch (NumberFormatException exp) {
|
||||
this.txtMail.setBackground(Color.RED);
|
||||
this.txtMdp.setBackground(Color.RED);
|
||||
JOptionPane.showMessageDialog(this,"Erreur dans la saisie");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
class StateListener implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.out.println("source : " + ((JRadioButton)e.getSource()).getText() + " - <20>tat : " + ((JRadioButton)e.getSource()).isSelected());
|
||||
}
|
||||
}
|
||||
}
|
||||
210
vue/Generale.java
Normal file
210
vue/Generale.java
Normal file
@@ -0,0 +1,210 @@
|
||||
package vue;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import controleur.Gestion;
|
||||
import controleur.Formateur;
|
||||
import vue.Formulaire.*;
|
||||
import vue.Liste.VueChevaux;
|
||||
import vue.Liste.VueCours;
|
||||
import vue.Liste.VueEleves;
|
||||
import vue.Liste.VueFormateurs;
|
||||
|
||||
public class Generale extends JFrame implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = -4529974363596089889L;
|
||||
/*VARIABLE*/
|
||||
private VueAccueil uneVueAccueil;
|
||||
private JMenuBar uneBarre = new JMenuBar();
|
||||
private JMenu mnFichier = new JMenu("Fichier");
|
||||
private JMenu mnGestion = new JMenu("Gestion");
|
||||
private JMenu mnCentre = new JMenu("Centre");
|
||||
private JMenuItem itemAccueil = new JMenuItem("Accueil");
|
||||
private JMenuItem itemQuitter = new JMenuItem("Quitter");
|
||||
private JMenuItem itemFormsEleves = new JMenuItem("Formulaire pour <20>l<EFBFBD>ves");
|
||||
private JMenuItem itemFormsChevaux = new JMenuItem("Formulaire pour chevaux");
|
||||
private JMenuItem itemFormsFormateurs = new JMenuItem("Formulaire pour formateurs");
|
||||
private JMenuItem itemFormsCours = new JMenuItem("Formulaire pour cours");
|
||||
private JMenuItem itemCours = new JMenuItem("Liste des cours");
|
||||
private JMenuItem itemEleves = new JMenuItem("Liste des <20>l<EFBFBD>ves");
|
||||
private JMenuItem itemChevaux = new JMenuItem("Liste des chevaux");
|
||||
private JMenuItem itemFormateurs= new JMenuItem("Liste des formateurs");
|
||||
private VueEleves uneVueEleve = new VueEleves();
|
||||
private VueCours uneVueCours = new VueCours();
|
||||
private VueChevaux uneVueCheval = new VueChevaux();
|
||||
private VueFormateurs uneVueFormateur = new VueFormateurs();
|
||||
private FormEleves uneFormEleve = new FormEleves();
|
||||
private FormChevaux uneFormCheval = new FormChevaux();
|
||||
private FormFormateurs uneFormFormateur = new FormFormateurs();
|
||||
private FormCours uneFormCour = new FormCours();
|
||||
/*AFFICHAGE GENERAL APPLI*/
|
||||
public Generale(Formateur unFormateur) {
|
||||
ImageIcon logo = new ImageIcon(new ImageIcon("./images/favicon.png").getImage().getScaledInstance(100, 100, Image.SCALE_DEFAULT));
|
||||
this.setIconImage(logo.getImage());
|
||||
this.setTitle("Ecuries");
|
||||
this.setBounds(300, 150, 800, 500);
|
||||
this.getContentPane().setBackground(new Color(247,245,226));
|
||||
this.setLayout(null);
|
||||
this.setResizable(true);
|
||||
this.uneVueAccueil = new VueAccueil(unFormateur);
|
||||
/*BARRE MENU GROUPE*/
|
||||
this.uneBarre.add(this.mnFichier);
|
||||
this.uneBarre.add(this.mnCentre);
|
||||
this.uneBarre.add(this.mnGestion);
|
||||
/*BARRE MENU LISTE GROUPE*/
|
||||
this.mnFichier.add(this.itemAccueil);
|
||||
this.mnFichier.add(this.itemQuitter);
|
||||
this.mnCentre.add(this.itemEleves);
|
||||
this.mnCentre.add(this.itemChevaux);
|
||||
this.mnCentre.add(this.itemCours);
|
||||
this.mnCentre.add(this.itemEleves);
|
||||
this.mnCentre.add(this.itemFormateurs);
|
||||
this.mnGestion.add(this.itemFormsEleves);
|
||||
this.mnGestion.add(this.itemFormsChevaux);
|
||||
this.mnGestion.add(this.itemFormsFormateurs);
|
||||
this.mnGestion.add(this.itemFormsCours);
|
||||
this.itemQuitter.addActionListener(this);
|
||||
this.itemAccueil.addActionListener(this);
|
||||
this.itemEleves.addActionListener(this);
|
||||
this.itemChevaux.addActionListener(this);
|
||||
this.itemCours.addActionListener(this);
|
||||
this.itemFormateurs.addActionListener(this);
|
||||
this.itemFormsEleves.addActionListener(this);
|
||||
this.itemFormsChevaux.addActionListener(this);
|
||||
this.itemFormsCours.addActionListener(this);
|
||||
this.itemFormsFormateurs.addActionListener(this);
|
||||
this.setJMenuBar(this.uneBarre);
|
||||
JLabel lbTitre = new JLabel("Connect<EFBFBD> en tant que : " + unFormateur.getPrenom() + " " + unFormateur.getNom());
|
||||
lbTitre.setBounds(250, 0, 300, 100);lbTitre.setFont(new Font(lbTitre.getText(), Font.PLAIN, 20));
|
||||
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
this.add(lbTitre) ;
|
||||
this.add(uneVueAccueil);
|
||||
this.add(uneFormEleve);
|
||||
this.add(uneFormCheval);
|
||||
this.add(uneFormFormateur);
|
||||
this.add(uneFormCour);
|
||||
this.add(uneVueCheval);
|
||||
this.add(uneVueEleve);
|
||||
this.add(uneVueCours);
|
||||
this.add(uneVueFormateur);
|
||||
this.setVisible(true);
|
||||
}
|
||||
/*ACTION GENERAL APPLI*/
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
if(e.getSource() == this.itemQuitter) {
|
||||
Gestion.rendreVisible(true);
|
||||
this.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemAccueil) {
|
||||
JLabel lbTitre = new JLabel("Accueil");
|
||||
lbTitre.setBounds(250, 0, 300, 100);
|
||||
uneVueAccueil.setVisible(true);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemFormsEleves) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(true);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemFormsChevaux) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(true);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemFormsFormateurs) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(true);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemFormsCours) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(true);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemCours) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(true);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemEleves) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(true);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(false);
|
||||
}
|
||||
else if (e.getSource()==this.itemChevaux) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(true);
|
||||
}
|
||||
else if (e.getSource()==this.itemFormateurs) {
|
||||
uneVueAccueil.setVisible(false);
|
||||
uneFormEleve.setVisible(false);
|
||||
uneFormCheval.setVisible(false);
|
||||
uneFormFormateur.setVisible(false);
|
||||
uneFormCour.setVisible(false);
|
||||
uneVueCours.setVisible(false);
|
||||
uneVueEleve.setVisible(false);
|
||||
uneVueCheval.setVisible(false);
|
||||
uneVueFormateur.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
vue/Liste/VueChevaux.java
Normal file
56
vue/Liste/VueChevaux.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package vue.Liste;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import controleur.Cheval;
|
||||
import modele.ModeleCheval;
|
||||
|
||||
public class VueChevaux extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = -4880909934785926048L;
|
||||
private JLabel titre = new JLabel(" Liste des Chevaux ");
|
||||
private JTable tableChevaux;
|
||||
public VueChevaux () {
|
||||
this.setBounds(30, 80, 720, 330);
|
||||
this.setLayout(null);
|
||||
this.setBackground(new Color(222,220,203));
|
||||
this.titre.setBounds(250, 0, 300, 50);
|
||||
this.titre.setFont(new Font(this.titre.getText(), Font.CENTER_BASELINE, 20));
|
||||
String titres [] = {"ID", "Nom", "Sexe", "Robe", "Type", "Race", "Propri<EFBFBD>taire", "Age", "Image"};
|
||||
this.tableChevaux = new JTable(this.extraireChevaux(), titres);
|
||||
JScrollPane uneScroll = new JScrollPane(this.tableChevaux);
|
||||
uneScroll.setBounds(10, 50, 700, 270);
|
||||
this.add(this.titre);
|
||||
this.add(uneScroll);
|
||||
this.setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
//extraire les Chevaux
|
||||
public Object [][] extraireChevaux () {
|
||||
ArrayList <Cheval> lesChevaux = ModeleCheval.selectAll();
|
||||
Object [][] donnees = new Object [lesChevaux.size()][9];
|
||||
int i =0;
|
||||
for (Cheval unCheval : lesChevaux) {
|
||||
donnees[i][0] = unCheval.getId();
|
||||
donnees[i][1] = unCheval.getNom();
|
||||
donnees[i][2] = unCheval.getSexe();
|
||||
donnees[i][3] = unCheval.getRobe();
|
||||
donnees[i][4] = unCheval.getType();
|
||||
donnees[i][5] = unCheval.getRace();
|
||||
donnees[i][6] = unCheval.getProprietaire();
|
||||
donnees[i][7] = unCheval.getAge();
|
||||
donnees[i][8] = unCheval.getImage();
|
||||
i++;
|
||||
}
|
||||
return donnees;
|
||||
}
|
||||
}
|
||||
55
vue/Liste/VueCours.java
Normal file
55
vue/Liste/VueCours.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package vue.Liste;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import controleur.Cours;
|
||||
import modele.ModeleCours;
|
||||
|
||||
public class VueCours extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 8159114212204714346L;
|
||||
private JLabel titre = new JLabel(" Liste des Cours ");
|
||||
private JTable tableCours;
|
||||
public VueCours ()
|
||||
{
|
||||
this.setBounds(30, 80, 720, 330);
|
||||
this.setLayout(null);
|
||||
this.setBackground(new Color(222,220,203));
|
||||
this.titre.setBounds(250, 0, 300, 50);
|
||||
this.add(this.titre);
|
||||
this.titre.setFont(new Font(this.titre.getText(), Font.CENTER_BASELINE, 20));
|
||||
String titres [] = {"ID du cours", "Date du cours", "D<EFBFBD>but <20>", "Fin <20>","Nombre <20>l<EFBFBD>ves"};
|
||||
this.tableCours = new JTable(this.extraireCours(), titres);
|
||||
JScrollPane uneScroll = new JScrollPane(this.tableCours);
|
||||
uneScroll.setBounds(10, 50, 700, 270);
|
||||
this.add(uneScroll);
|
||||
|
||||
this.setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
//Extraire les Cours
|
||||
public Object [][] extraireCours ()
|
||||
{
|
||||
ArrayList <Cours> lesCours = ModeleCours.selectAll();
|
||||
Object [][] donnees = new Object [lesCours.size()][5];
|
||||
int i =0;
|
||||
for (Cours unCours : lesCours)
|
||||
{
|
||||
donnees[i][0] = unCours.getIdCours();
|
||||
donnees[i][1] = unCours.getDateCours();
|
||||
donnees[i][2] = unCours.getHeureDebut();
|
||||
donnees[i][3] = unCours.getHeureFin();
|
||||
i++;
|
||||
}
|
||||
return donnees;
|
||||
}
|
||||
}
|
||||
60
vue/Liste/VueEleves.java
Normal file
60
vue/Liste/VueEleves.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package vue.Liste;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import controleur.Eleve;
|
||||
import modele.ModeleEleve;
|
||||
|
||||
public class VueEleves extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = -3553328743149224396L;
|
||||
private JLabel titre = new JLabel(" Liste des <20>l<EFBFBD>ves ");
|
||||
private JTable tableEleves;
|
||||
public VueEleves () {
|
||||
this.setBounds(30, 80, 720, 330);
|
||||
this.setLayout(null);
|
||||
this.setBackground(new Color(222,220,203));
|
||||
this.titre.setBounds(250, 0, 300, 50);
|
||||
this.add(this.titre);
|
||||
this.titre.setFont(new Font(this.titre.getText(), Font.CENTER_BASELINE, 20));
|
||||
String titres [] = {"ID", "Privilege", "Record", "Pseudo", "Pr<EFBFBD>nom", "Nom", "Sexe", "<EFBFBD>ge", "Adresse", "MDP", "Email", "Galop", "Image"};
|
||||
this.tableEleves = new JTable(this.extraireEleves(), titres);
|
||||
JScrollPane uneScroll = new JScrollPane(this.tableEleves);
|
||||
uneScroll.setBounds(10, 50, 700, 270);
|
||||
this.add(uneScroll);
|
||||
this.setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
//extraire les Eleves
|
||||
public Object [][] extraireEleves () {
|
||||
ArrayList <Eleve> lesEleves = ModeleEleve.selectAll();
|
||||
Object [][] donnees = new Object [lesEleves.size()][13];
|
||||
int i =0;
|
||||
for (Eleve unEleve : lesEleves) {
|
||||
donnees[i][0] = unEleve.getId();
|
||||
donnees[i][1] = unEleve.getPrivilege();
|
||||
donnees[i][2] = unEleve.getRecord();
|
||||
donnees[i][3] = unEleve.getPseudo();
|
||||
donnees[i][4] = unEleve.getPrenom();
|
||||
donnees[i][5] = unEleve.getNom();
|
||||
donnees[i][6] = unEleve.getSexe();
|
||||
donnees[i][7] = unEleve.getAge();
|
||||
donnees[i][8] = unEleve.getAdresse();
|
||||
donnees[i][9] = unEleve.getMdp();
|
||||
donnees[i][10] = unEleve.getMail();
|
||||
donnees[i][11] = unEleve.getGalop();
|
||||
donnees[i][12] = unEleve.getImageEleve();
|
||||
i++;
|
||||
}
|
||||
return donnees;
|
||||
}
|
||||
}
|
||||
59
vue/Liste/VueFormateurs.java
Normal file
59
vue/Liste/VueFormateurs.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package vue.Liste;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import controleur.Formateur;
|
||||
import modele.ModeleFormateur;
|
||||
|
||||
public class VueFormateurs extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 7809272439139152072L;
|
||||
private JLabel titre = new JLabel(" Liste des Formateurs ");
|
||||
private JTable tableFormateurs;
|
||||
public VueFormateurs ()
|
||||
{
|
||||
this.setBounds(30, 80, 720, 330);
|
||||
this.setLayout(null);
|
||||
this.setBackground(new Color(222,220,203));
|
||||
this.titre.setBounds(250, 0, 300, 50);
|
||||
this.titre.setFont(new Font(this.titre.getText(), Font.CENTER_BASELINE, 20));
|
||||
String titres [] = {"ID","Login", "Privilege", "Pr<EFBFBD>nom", "Nom", "Age", "Galop", "Sexe", "Email", "MDP"};
|
||||
this.tableFormateurs = new JTable(this.extraireFormateurs(), titres);
|
||||
JScrollPane uneScroll = new JScrollPane(this.tableFormateurs);
|
||||
uneScroll.setBounds(10, 50, 700, 270);
|
||||
this.add(this.titre);
|
||||
this.add(uneScroll);
|
||||
this.setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
//extraire les Formateurs
|
||||
public Object [][] extraireFormateurs () {
|
||||
ArrayList <Formateur> lesFormateurs = ModeleFormateur.selectAll();
|
||||
Object [][] donnees = new Object [lesFormateurs.size()][10];
|
||||
int i =0;
|
||||
for (Formateur unFormateur : lesFormateurs)
|
||||
{
|
||||
donnees[i][0] = unFormateur.getId();
|
||||
donnees[i][1] = unFormateur.getLogin();
|
||||
donnees[i][2] = unFormateur.getPrivilege();
|
||||
donnees[i][3] = unFormateur.getPrenom();
|
||||
donnees[i][4] = unFormateur.getNom();
|
||||
donnees[i][5] = unFormateur.getAge();
|
||||
donnees[i][6] = unFormateur.getGalop();
|
||||
donnees[i][7] = unFormateur.getSexe();
|
||||
donnees[i][8] = unFormateur.getMail();
|
||||
donnees[i][9] = unFormateur.getMdp();
|
||||
i++;
|
||||
}
|
||||
return donnees;
|
||||
}
|
||||
}
|
||||
38
vue/VueAccueil.java
Normal file
38
vue/VueAccueil.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package vue;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
import controleur.Formateur;
|
||||
|
||||
public class VueAccueil extends JPanel
|
||||
{
|
||||
private static final long serialVersionUID = -3549267272035293251L;
|
||||
public VueAccueil(Formateur unFormateur)
|
||||
{
|
||||
this.setBounds(30, 80, 720, 330);
|
||||
this.setBackground(new Color(222,220,203));
|
||||
this.setLayout(null);
|
||||
JLabel lbFormateur = new JLabel("Accueil / Votre Formateur");
|
||||
lbFormateur.setBounds(250, 0, 300, 50);
|
||||
lbFormateur.setFont(new Font(lbFormateur.getText(), Font.CENTER_BASELINE + Font.BOLD, 20));
|
||||
JTextArea txtTitre = new JTextArea();
|
||||
txtTitre.setBounds(30, 50, 660, 250);
|
||||
//txtTitre.setBounds(x, y, width, height);
|
||||
txtTitre.setEditable(false);
|
||||
txtTitre.setBackground(new Color(197,196,180));
|
||||
txtTitre.setFont(new Font(txtTitre.getText(), Font.PLAIN, 16));
|
||||
// txtTitre.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
|
||||
txtTitre.setText( "\n Nom : " + "" + unFormateur.getNom()
|
||||
+ "\n Pr<50>nom : " + "" + unFormateur.getPrenom()
|
||||
+ "\n Age : " + "" + unFormateur.getAge()
|
||||
+ "\n Sexe : " + "" + unFormateur.getSexe()
|
||||
+ "\n Galop : " + "" + unFormateur.getGalop()
|
||||
+ "\n Privilege : " + "" + unFormateur.getPrivilege());
|
||||
this.add(lbFormateur);
|
||||
this.add(txtTitre);
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
70
vue/VueConnexion.java
Normal file
70
vue/VueConnexion.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package vue;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import controleur.Gestion;
|
||||
import controleur.Formateur;
|
||||
import modele.ModeleFormateur;
|
||||
|
||||
public class VueConnexion extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 9053959881019676053L;
|
||||
private JTextField txtMail = new JTextField("sa@gmail.com");
|
||||
private JPasswordField txtMdp = new JPasswordField("P@ssword");
|
||||
private JButton btAnnuler = new JButton("Annuler");
|
||||
private JButton btSeConnecter = new JButton("Se connecter");
|
||||
public VueConnexion()
|
||||
{
|
||||
this.setBounds(60, 100, 350, 100);
|
||||
this.setLayout(new GridLayout(3, 2));
|
||||
this.setBackground(new Color(222,220,203));
|
||||
JLabel lbMail = new JLabel(" E-mail :");lbMail.setFont(new Font(lbMail.getText(), Font.CENTER_BASELINE, 16));
|
||||
JLabel lbMdp = new JLabel(" Mot de passe :");lbMdp.setFont(new Font(lbMdp.getText(), Font.CENTER_BASELINE, 16));
|
||||
this.btAnnuler.setIcon(new ImageIcon(new ImageIcon("src/images/choix1.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
|
||||
this.btAnnuler.addActionListener(this);
|
||||
this.btSeConnecter.setIcon(new ImageIcon(new ImageIcon("src/images/choix2.png").getImage().getScaledInstance(15, 15, Image.SCALE_DEFAULT)));
|
||||
this.btSeConnecter.addActionListener(this);
|
||||
this.add(lbMail);this.add(this.txtMail);
|
||||
this.add(lbMdp);this.add(this.txtMdp);
|
||||
this.add(this.btAnnuler);this.add(this.btSeConnecter);
|
||||
this.setVisible(true);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
if(e.getSource() == this.btAnnuler) {
|
||||
this.txtMail.setText("");
|
||||
this.txtMdp.setText("");
|
||||
}
|
||||
else if(e.getSource() == this.btSeConnecter) {
|
||||
String email = this.txtMail.getText();
|
||||
String mdp = new String(this.txtMdp.getPassword());
|
||||
Formateur unFormateur = ModeleFormateur.selectWhere(email, mdp);
|
||||
if(unFormateur == null) {
|
||||
JOptionPane.showMessageDialog(this, "Veuillez v<>rifier vos identifiants !");
|
||||
}
|
||||
else {
|
||||
JOptionPane.showMessageDialog(this, "Connexion r<>ussie\n"
|
||||
+ "Bienvenue M./Mme\n" + " "
|
||||
+ unFormateur.getNom() + " "
|
||||
+ unFormateur.getPrenom());
|
||||
// ouvrir le menu g<>n<EFBFBD>ral
|
||||
new Generale(unFormateur);
|
||||
this.txtMail.setText("");
|
||||
this.txtMdp.setText("");
|
||||
Gestion.rendreVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user