我想在拍摄前检查头部元素但
java.lang.NullPointerException
偷看时抬起,
使用 java BlockingQueue
BlockingQueue sharedQueue = new LinkedBlockingQueue()
这是我的代码,有什么想法吗?
while(true){
try {
if(!sharedQueue.isEmpty()){
char ch = (char)sharedQueue.peek();
if(Character.isDigit(ch)){
digitTextField.setText(digitTextField.getText()+sharedQueue.take());
}
}
} catch (InterruptedException ex) {
Logger.getLogger(Form.class.getName()).log(Level.SEVERE, null, ex);
}
}