else {   done = true; } } setCursorActive(true);
   public void sendKeys(String text) {//      if (text == null) {//         return;//      }      if (isStatusErrorCode() && !resetRequired) {            resetError();            if (!cursorActive)               setCursorOn();      }      if (keyboardLocked) {         if(text.equals("[reset]") || text.equals("[sysreq]")                  || text.equals("[attn]")) {            simulateMnemonic(getMnemonicValue(text));         }         else {            if (isStatusErrorCode()) {               Toolkit.getDefaultToolkit().beep();               return;            }            keysBuffered = true;            setKBIndicatorOn();            if(bufferedKeys == null){               bufferedKeys = text;               return;            }            else {               bufferedKeys += text;                  return;            }         }      }      else {         if (keysBuffered) {            if (bufferedKeys != null) {               text = bufferedKeys + text;            }            keysBuffered = false;            setKBIndicatorOff();            bufferedKeys = null;         }         // check to see if position is in a field and if it is then change         //   current field to that field         isInField(lastPos,true);         if (text.length() == 1 && !text.equals("[") && !text.equals("]")) {               simulateKeyStroke(text.charAt(0));         }         else {            strokenizer.setKeyStrokes(text);            String s;            boolean done = false;            while (strokenizer.hasMoreKeyStrokes()  && !keyboardLocked &&                        !isStatusErrorCode() && !done) {               s = strokenizer.nextKeyStroke();               if (s.length() == 1) {                  simulateKeyStroke(s.charAt(0));                  setCursorOn();               }               else {                  if (s != null) {                     simulateMnemonic(getMnemonicValue(s));                  }                  else                     System.out.println(" send keys mnemonic " + s);               }               if (keyboardLocked) {                  bufferedKeys = strokenizer.getUnprocessedKeyStroked();                  if (bufferedKeys != null) {                     keysBuffered = true;                     setKBIndicatorOn();                  }                  done = true;               }            }         }      }   }