1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
| public class FenSaisieAuthentification extends JDialog {
AppliGraphe AppliParent;
GrapheSPUDAO SpuDao=null;
JLabel lblLogin, lblMdp, lblConsigne;
JTextField txtLogin;
JPasswordField txtMdp;
ValiderJButton btnValider=null;
ArrayList ListeGraphe;
int Ecart=15;
public boolean connecte=false;
public FenSaisieAuthentification() {
super();
setTitle("Authentification");
setSize(300,250);
setAlwaysOnTop(true);
setLocation(560,368);
setResizable(false);
setVisible(true);
lblConsigne = new JLabel();
lblConsigne.setText("Veuillez vous indentifier...");
lblConsigne.setLocation(15,10);
lblConsigne.setSize(this.getWidth() -115,30);
lblConsigne.setVisible(true);
this.add(lblConsigne);
lblLogin = new JLabel();
lblLogin.setText("Login :");
lblLogin.setLocation(15,60);
lblLogin.setSize(100, 25);
lblLogin.setVisible(true);
this.add(lblLogin);
txtLogin = new JTextField();
txtLogin.setLocation(Ecart+lblLogin.getWidth(), lblLogin.getY());
txtLogin.setSize(130, 25);
txtLogin.setVisible(true);
this.add(txtLogin);
lblMdp = new JLabel();
lblMdp.setText("Mot de Passe :");
lblMdp.setLocation(15,110);
lblMdp.setSize(100, 25);
lblMdp.setVisible(true);
this.add(lblMdp);
txtMdp = new JPasswordField();
txtMdp.setLocation(Ecart+lblMdp.getWidth(), lblMdp.getY());
txtMdp.setSize(130, 25);
txtMdp.setVisible(true);
this.add(txtMdp);
btnValider=new ValiderJButton("Valider");
btnValider.setSize(120,25);
btnValider.setLocation(90,160);
btnValider.setVisible(true);
this.add(btnValider);
btnValider.addActionListener(new ButtonListener());
}
//classe qui implémente ActionListener
class ButtonListener implements ActionListener {
ButtonListener() {
}
public void actionPerformed(ActionEvent e)
{
setAlwaysOnTop(false);
//variables qui récupèrent les données saisies
String login = txtLogin.getText();
String mdp = txtMdp.getText();
System.out.println("1");
SpuDao = new GrapheSPUDAO();
System.out.println("2");
ListeGraphe = new ArrayList();
System.out.println(connecte);
//s'il s'agit du bouton valider
if(e.getActionCommand().equals("Valider")){
if((login.equals("")) || (mdp.equals("")) ){
JOptionPane.showMessageDialog(null, "Saisissez un login et un mot de passe ", "Erreur de saisie", JOptionPane.ERROR_MESSAGE);
}
else {
AppliParent= new AppliGraphe();
ListeGraphe=AppliParent.Controller.chargerFindUser(login,mdp);
connecte = GrapheSPUDAO.connecte;
System.out.println(connecte);
}
if(connecte){
//AppliParent.Controller.FinAuthentification(connecte);
System.out.println(ListeGraphe);
dispose();
}
}
}
}
public ArrayList getListeGraphe(){
if(connecte){
System.out.println("la liste finale==>"+ListeGraphe);
}
return ListeGraphe;
} |
Partager