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
| private void jButtonGenerarOrinaActionPerformed(java.awt.event.ActionEvent evt) {
//on fait choisir l'emplacement souhaiter pour le fichier
int x = ba_rchhAlumno.WIDTH / 2;
int y = ba_rchhAlumno.HEIGHT / 2;
SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy");
Date d = new Date();
d.getTime();
String name_file = "ExamenOrina_" + f.format(d) + ".xls";
this.jFileChooserAlumno.setSelectedFile(new File(name_file));
this.jFileChooserAlumno.setLocation(x, y);
val = this.jFileChooserAlumno.showSaveDialog(this);
// ici jFileChooserAlumno n'est plus afficher à l'ecran
boolean b = false;
System.out.println(val);
// si l'utilisateur a fermer la fenetre par APPROVE_OPTION
if (val == JFileChooser.APPROVE_OPTION) {
File file = this.jFileChooserAlumno.getSelectedFile();
try {
b = a_template.u.genererExcelOrina(file);
} catch (ClassNotFoundException ex) {
Logger.getLogger(ba_rchhAlumno.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(ba_rchhAlumno.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(b);
if (b) {
this.jLabel1.setText("La lista ha sido registrada a la dirección siguiente : " + file.getPath());
} else {
this.jLabel1.setText("La lista no pudo ser registrada a la dirección siguiente : " + file.getPath());
}
new JOptionPane("erreur").showMessageDialog(null, "message d'erreur", "titre", JOptionPane.WARNING_MESSAGE);
} |