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
| private JButton getBtnNext() {
if (btnNext == null) {
btnNext = new JButton("Suivant");
btnNext.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//Nous déclarons nos objets en dehors du bloc try/catch
File file = new File ("client.txt");
FileReader fr;
int c;
String str="";
try {
//création de l'objet
fr = new FileReader(file);
//on lit les données
while ((c = fr.read()) != 59){
str += (char)c;
}
textField_Matricule.setText(str);
str="";
while ((c = fr.read()) != 59){
str += (char)c;
}
textField_Identifiant.setText(str);
str="";
while ((c = fr.read()) != 59){
str += (char)c;
}
textField_Nom.setText(str);
str="";
while ((c = fr.read()) != 59){
str += (char)c;
}
textField_Prenom.setText(str);
str="";
while ((c = fr.read()) != 59){
str += (char)c;
}
textField_Tel.setText(str);
str="";
while ((c = fr.read()) != 10){
str += (char)c;
}
textField_Mail.setText(str);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
btnNext.setBounds(177, 267, 89, 23);
}
return btnNext;
} |
Partager