Forum Stats

  • 3,838,749 Users
  • 2,262,397 Discussions
  • 7,900,750 Comments

Discussions

[ASK] Temporary Fingerprint Scanner Save File

1002188
1002188 Member Posts: 1
edited Apr 10, 2013 7:05AM in Java Desktop Applications
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

Answers

This discussion has been closed.