void (int repeat, boolean otherKey) { for (int i = 0; i < repeat; i++) { dispatchEvent(KeyEvent.KEY_PRESSED, InputEvent.SHIFT_MASK, otherKey ? KeyEvent.VK_ENTER : KeyEvent.VK_BACK_SPACE, otherKey ? '\n' : '\b'); dispatchEvent(KeyEvent.KEY_TYPED, InputEvent.SHIFT_MASK, 0, otherKey ? '\n' : '\b'); } dispatchEvent(KeyEvent.KEY_RELEASED, InputEvent.SHIFT_MASK, otherKey ? KeyEvent.VK_ENTER : KeyEvent.VK_BACK_SPACE, otherKey ? '\n' : '\b'); }