지문 스캐너를 사용할 수있는 JNI와 인터페이스하고 있습니다. 필자가 작성한 코드는 스캔 된 ByteBuffer를 JNI가 파싱 한 후 BufferedImage로 저장하여 저장합니다.스레드에서 플래그 변수 가져 오기 및 설정
내가 알 수없는 것은 내 GUI의 jlabel 아이콘이 업데이트되기 전에 스캔 스레드가 끝날 때까지 기다리는 방법입니다. 이 작업을 수행하는 가장 쉬운 방법은 무엇입니까?
추가로 필요한 항목이 있습니까?
편집합니다 스캔 스레드의 끝에
//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
}
스캔 스레드 내부에서 실행되는 코드를 표시 할 수 있습니까? – mthmulders