private void sendKeys(List<KeyEvent> events) { for (KeyEvent event : events) { if (event.isNewLine()) { exec.key(OperaKey.ENTER.toScope()); } else if (event.isModifierRelease()) { releaseModifiers(); } else if (event.isModifier()) { pressOrReleaseModifier(event.getKey()); } else if (event.isSpecial()) { exec.key(OperaKey.get(event.getKey()).toScope()); } else { type(event.getCharacter()); } } }
public void pressKey(Keys keyToPress) { modifiers.add(keyToPress); exec.key(OperaKey.get(keyToPress).toScope(), false); }
public void releaseKey(Keys keyToRelease) { modifiers.remove(keyToRelease); exec.key(OperaKey.get(keyToRelease).toScope(), true); }