I am interacting with JNI, which allows me to use a fingerprint scanner. The code I wrote takes a scanned ByteBuffer, processed back by JNI, and turns it into a BufferedImage to save.
I cannot figure out how to wait for the validation flow to complete before the jlabel icon in my GUI tries to update. What would be the easiest way to do this?
What else do I need to add?
Edit:
//Scanner class Thread thread = new Thread() { public void run() { // [...] get ByteBuffer and Create Image code try { File out = new File("C:\\Users\\Desktop\\print.png"); ImageIO.write(padded, "png", out); // [???] set flag here } catch (IOException e) { e.printStackTrace(); } } }; thread.start(); return true; //Gui class private void btnScanPrintActionPerformed(java.awt.event.ActionEvent evt) { Scanner scanPrint = new Scanner(); boolean x = scanPrint.initDevice(); //Wait for the scanning thread to finish the Update the jLabel here to show //the fingerprint }
source share