2 Replies Latest reply: Apr 10, 2013 6:05 AM by gimbal2 RSS

    [ASK] Temporary Fingerprint Scanner Save File

    1002188
      Hi all
      i have a problem with my project to pass the graduation..
      i try to make a attendance fingerprint system..

      my problem is when i scan my fingerprint and save my fingerprint template.. and then i close my netbeans...
      the save file is not save, being deleted... and i must scan my fingerprint again if i want to verification them..

      anyone can help my problem..

      thanks...

      --- Here The code ---
      private void onSave() {
                JFileChooser chooser = new JFileChooser();
                chooser.addChoosableFileFilter(new TemplateFileFilter());
                while (true) {
                     if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
                          try {
                               File file = chooser.getSelectedFile();
                                              //file="xxx";
                               if (!file.toString().toLowerCase().endsWith(".fpt"))
                                    file = new File(file.toString() + ".fpt");
                                                     // file=file.toString()+".fpt";
                               if (file.exists()) {
                                    int choice = JOptionPane.showConfirmDialog(this,
                                         String.format("File \"%1$s\" sudah ada.\nApakah mau mengganti?", file.toString()),
                                         "Penyimpanan Sidik Jari",
                                         JOptionPane.YES_NO_CANCEL_OPTION);
                                    if (choice == JOptionPane.NO_OPTION)
                                         continue;
                                    else if (choice == JOptionPane.CANCEL_OPTION)
                                         break;
                                          }
                               FileOutputStream stream = new FileOutputStream(file);
                               stream.write(getTemplate().serialize());
                               stream.close();
                          } catch (Exception ex) {
                               JOptionPane.showMessageDialog(this, ex.getLocalizedMessage(), "Penyimpanan Sidik Jari", JOptionPane.ERROR_MESSAGE);
                          }
                     }
                     break;
                }
           }
      Edited by: 999185 on Apr 10, 2013 2:59 AM