From 57539c49c6d8e09774e94177de203c148d7281cb Mon Sep 17 00:00:00 2001 From: weihongyang <1075331873@qq.com> Date: Tue, 21 Jun 2022 07:39:07 +0800 Subject: [PATCH] commit init --- .../cnbm/barcode/listener/GlobalKeyListenerExample.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java b/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java index ddff3ec..1bc1d10 100644 --- a/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java +++ b/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java @@ -40,8 +40,9 @@ public class GlobalKeyListenerExample implements NativeKeyListener { } catch (InterruptedException ex) { ex.printStackTrace(); } + log.info("queue的数据是:"+queue.toString()); 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 = ""; List collect = queue.stream().map(n -> { return NativeKeyEvent.getKeyText(n); @@ -50,7 +51,11 @@ public class GlobalKeyListenerExample implements NativeKeyListener { for (String s : collect) { 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(); } if (queue.size() == 6){