fix: 修改扫码枪监听

This commit is contained in:
weihongyang 2022-06-21 09:44:15 +08:00
parent 37a7f6ae13
commit 266ce0c6a7

View File

@ -48,14 +48,17 @@ public class GlobalKeyListenerExample implements NativeKeyListener {
return NativeKeyEvent.getKeyText(n); return NativeKeyEvent.getKeyText(n);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (queue.size() == 5) {
for (String s : collect) { for (String s : collect) {
result = result + s; result = result + s;
} }
if (queue.size() == 5) {
log.info("符合标准的扫码是:"+ result.replace("Enter",""));
}else { }else {
log.info("符合标准的扫码是:"+ result.substring(1).replace("Enter","")); for (int i = 1; i < collect.size(); i++) {
result = result + collect.get(i);
} }
}
log.info("符合标准的扫码是:"+ result.replace("Enter",""));
queue.clear(); queue.clear();
} }
if (queue.size() == 6){ if (queue.size() == 6){