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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
| /*
* CFAccueil.java
*
* Created on 11 février 2009, 11:00
*/
package PFiches;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Fanny
*/
public class CFAccueil extends javax.swing.JFrame {
CFMenu FMenu;
CFCreerProfil FCréerProfil;
CFRechercheMC FRechercheMC;
String nom;
String m_d_p;
/** Creates new form CFAccueil */
public CFAccueil() throws FileNotFoundException, IOException {
initComponents();
FCréerProfil = new CFCreerProfil(this,false);
FRechercheMC = new CFRechercheMC(this,false);
FMenu = new CFMenu(this,false);
//Lecture des fichier
Cutilisateur.lecture_ut();
Cphoto.lecture_photo();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
lTexteaccueil = new javax.swing.JLabel();
tfNom = new javax.swing.JTextField();
lTexteaccueil1 = new javax.swing.JLabel();
pfMotdePasse = new javax.swing.JPasswordField();
lMotdePasse = new javax.swing.JLabel();
bOK = new javax.swing.JButton();
bQuitter = new javax.swing.JButton();
bCréationProfil = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Accueil");
setBackground(java.awt.Color.darkGray);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setForeground(new java.awt.Color(0, 204, 0));
lTexteaccueil.setFont(new java.awt.Font("Tahoma", 0, 24));
lTexteaccueil.setText("Bienvenue sur Mezimages");
tfNom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfNomActionPerformed(evt);
}
});
lTexteaccueil1.setText("Entrez votre identifiant :");
pfMotdePasse.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pfMotdePasseActionPerformed(evt);
}
});
lMotdePasse.setText("Entrez votre mot de passe :");
bOK.setText("OK");
bOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bOKActionPerformed(evt);
}
});
bQuitter.setText("Quitter");
bQuitter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bQuitterActionPerformed(evt);
}
});
bCréationProfil.setText("Créer un profil");
bCréationProfil.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bCréationProfilActionPerformed(evt);
}
});
jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(56, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(lTexteaccueil)
.addGap(61, 61, 61))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(bOK)
.addGap(49, 49, 49))
.addComponent(lTexteaccueil1)
.addComponent(tfNom, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
.addComponent(lMotdePasse)
.addComponent(pfMotdePasse, javax.swing.GroupLayout.Alignment.TRAILING))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(117, 117, 117)
.addComponent(bQuitter)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bCréationProfil)
.addGap(48, 48, 48))))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(lTexteaccueil, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(34, 34, 34)
.addComponent(lTexteaccueil1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(lMotdePasse)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pfMotdePasse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bOK))
.addGroup(layout.createSequentialGroup()
.addGap(81, 81, 81)
.addComponent(bCréationProfil)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addComponent(bQuitter)))
.addContainerGap())
);
pack();
}// </editor-fold>
private void bOKActionPerformed(java.awt.event.ActionEvent evt) {
boolean connexion;
String mdp = new String (pfMotdePasse.getPassword());
m_d_p=mdp;
connexion=Cutilisateur.verif_connexion(tfNom.getText(),mdp );
nom = tfNom.getText();
if(connexion){
Cutilisateur utilisateur = new Cutilisateur(tfNom.getText(),mdp);
this.setVisible(false);
FMenu.recup_util(utilisateur);
FMenu.setVisible(true);
} else {
JOptionPane.showMessageDialog(this, "Identifiant ou mot de passe incorrect");
}
}
private void tfNomActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void bQuitterActionPerformed(java.awt.event.ActionEvent evt) {
try {
Cutilisateur.enregistrement_fich();
} catch (FileNotFoundException ex) {
Logger.getLogger(CFAccueil.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(CFAccueil.class.getName()).log(Level.SEVERE, null, ex);
}
System.exit(0);
}
private void bCréationProfilActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
FCréerProfil.setVisible(true);
}
private void pfMotdePasseActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
public String get_nom(){
String nom;
return(tfNom.getText());
}
public String get_mdp(){
String mdp = new String (pfMotdePasse.getPassword());
return(mdp);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new CFAccueil().setVisible(true);
} catch (FileNotFoundException ex) {
Logger.getLogger(CFAccueil.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(CFAccueil.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton bCréationProfil;
private javax.swing.JButton bOK;
private javax.swing.JButton bQuitter;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JLabel lMotdePasse;
private javax.swing.JLabel lTexteaccueil;
private javax.swing.JLabel lTexteaccueil1;
private javax.swing.JPasswordField pfMotdePasse;
private javax.swing.JTextField tfNom;
// End of variables declaration
} |
Partager