commit init

This commit is contained in:
weihongyang 2022-06-21 07:39:07 +08:00
parent 7aaa6700b3
commit 57539c49c6

View File

@ -40,8 +40,9 @@ public class GlobalKeyListenerExample implements NativeKeyListener {
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
log.info("queue的数据是"+queue.toString());
int[] hotKeyArray1 = {NativeKeyEvent.VC_X, NativeKeyEvent.VC_Y,NativeKeyEvent.VC_Z}; int[] hotKeyArray1 = {NativeKeyEvent.VC_X, NativeKeyEvent.VC_Y,NativeKeyEvent.VC_Z};
if (queue.size() == 5 && e.getKeyCode() == NativeKeyEvent.VC_ENTER && judgeCombinationKey(hotKeyArray1)){ if (5 <= queue.size() && queue.size()<= 6 && e.getKeyCode() == NativeKeyEvent.VC_ENTER && judgeCombinationKey(hotKeyArray1)){
String result = ""; String result = "";
List<String> collect = queue.stream().map(n -> { List<String> collect = queue.stream().map(n -> {
return NativeKeyEvent.getKeyText(n); return NativeKeyEvent.getKeyText(n);
@ -50,7 +51,11 @@ public class GlobalKeyListenerExample implements NativeKeyListener {
for (String s : collect) { for (String s : collect) {
result = result + s; result = result + s;
} }
log.info("符合标准的扫码是:"+ result); if (queue.size() == 5) {
log.info("符合标准的扫码是:"+ result.replace("Enter",""));
}else {
log.info("符合标准的扫码是:"+ result.substring(1).replace("Enter",""));
}
queue.clear(); queue.clear();
} }
if (queue.size() == 6){ if (queue.size() == 6){