Java Code Examples for java.awt.event.KeyEvent#isAltGraphDown()
The following examples show how to use
java.awt.event.KeyEvent#isAltGraphDown() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyStroker.java From tn5250j with GNU General Public License v2.0 | 6 votes |
public KeyStroker(KeyEvent ke) { this.keyCode = ke.getKeyCode(); this.isShiftDown = ke.isShiftDown(); this.isControlDown = ke.isControlDown(); this.isAltDown = ke.isAltDown(); this.isAltGrDown = ke.isAltGraphDown(); this.location = ke.getKeyLocation(); hashCode = keyCode + (isShiftDown ? 1 : 0) + (isControlDown ? 1 : 0) + (isAltDown ? 1 : 0) + (isAltGrDown ? 1 : 0) + location; }
Example 2
Source File: WatchAnnotationProvider.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isMetaDown() || e.isShiftDown()) { setSelectCursor(); } }
Example 3
Source File: WatchAnnotationProvider.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void keyReleased(KeyEvent e) { if (!(e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isMetaDown() || e.isShiftDown())) { unsetSelectCursor(); } }
Example 4
Source File: KeyStroker.java From tn5250j with GNU General Public License v2.0 | 5 votes |
public boolean equals(KeyEvent ke) { return (keyCode == ke.getKeyCode() && isShiftDown == ke.isShiftDown() && isControlDown == ke.isControlDown() && isAltDown == ke.isAltDown() && isAltGrDown == ke.isAltGraphDown() && location == ke.getKeyLocation()); }
Example 5
Source File: GameKeyHandler.java From stendhal with GNU General Public License v2.0 | 4 votes |
@Override public void keyPressed(final KeyEvent e) { final int keyCode = e.getKeyCode(); final boolean doublePress = isDoublePress(keyCode); /* Ignore if the key is already pressed down. */ if (!client.keyIsPressed(keyCode)) { /* Add keyCode to pressedStateKeys list. */ client.onKeyPressed(keyCode); if (e.isShiftDown()) { /* * We are going to use shift to move to previous/next line of text * with arrows so we just ignore the keys if shift is pressed. */ return; } switch (keyCode) { case KeyEvent.VK_R: if (e.isControlDown()) { /* * Ctrl+R Remove text bubbles */ screen.clearTexts(); } break; case KeyEvent.VK_LEFT: case KeyEvent.VK_RIGHT: case KeyEvent.VK_UP: case KeyEvent.VK_DOWN: case KeyEvent.VK_KP_LEFT: case KeyEvent.VK_KP_RIGHT: case KeyEvent.VK_KP_UP: case KeyEvent.VK_KP_DOWN: /* * Ctrl means face, otherwise move. Alt turns on auto-walk. */ final Direction direction = keyCodeToDirection(e.getKeyCode()); /* Check if the player is currently using auto-walk or the Alt * key is pressed. */ User user = User.get(); if ((user.getRPObject().has(AUTOWALK) || ("true".equals(WtWindowManager.getInstance().getProperty(DOUBLE_TAP_AUTOWALK_PROPERTY, "false")) && doublePress))) { /* Face direction pressed and toggle auto-walk. */ this.processAutoWalk(direction, user); } else { if (e.isAltGraphDown()) { if (System.currentTimeMillis() - lastAction > 1000) { final EntityView<?> view = screen.getEntityViewAt( user.getX() + direction.getdx(), user.getY() + direction.getdy()); if (view != null) { final IEntity entity = view.getEntity(); if (!entity.equals(user)) { view.onAction(); lastAction = System.currentTimeMillis(); } } } } this.processDirectionPress(direction, e.isControlDown()); } break; case KeyEvent.VK_0: case KeyEvent.VK_1: case KeyEvent.VK_2: case KeyEvent.VK_3: case KeyEvent.VK_4: case KeyEvent.VK_5: case KeyEvent.VK_6: case KeyEvent.VK_7: case KeyEvent.VK_8: case KeyEvent.VK_9: switchToSpellCastingState(e); break; } } }
Example 6
Source File: DefaultKeyboardHandler.java From tn5250j with GNU General Public License v2.0 | 4 votes |
protected void displayInfo(KeyEvent e, String s) { String charString, keyCodeString, modString, tmpString, isString; char c = e.getKeyChar(); int keyCode = e.getKeyCode(); int modifiers = e.getModifiers(); if (Character.isISOControl(c)) { charString = "key character = " + "(an unprintable control character)"; } else { charString = "key character = '" + c + "'"; } keyCodeString = "key code = " + keyCode + " (" + KeyEvent.getKeyText(keyCode) + ")"; if (keyCode == KeyEvent.VK_PREVIOUS_CANDIDATE) { keyCodeString += " previous candidate "; } if (keyCode == KeyEvent.VK_DEAD_ABOVEDOT || keyCode == KeyEvent.VK_DEAD_ABOVERING || keyCode == KeyEvent.VK_DEAD_ACUTE || keyCode == KeyEvent.VK_DEAD_BREVE || keyCode == KeyEvent.VK_DEAD_CIRCUMFLEX ) { keyCodeString += " dead key "; } modString = "modifiers = " + modifiers; tmpString = KeyEvent.getKeyModifiersText(modifiers); if (tmpString.length() > 0) { modString += " (" + tmpString + ")"; } else { modString += " (no modifiers)"; } isString = "isKeys = isActionKey (" + e.isActionKey() + ")" + " isAltDown (" + e.isAltDown() + ")" + " isAltGraphDown (" + e.isAltGraphDown() + ")" + " isAltGraphDownLinux (" + isAltGr + ")" + " isControlDown (" + e.isControlDown() + ")" + " isMetaDown (" + e.isMetaDown() + ")" + " isShiftDown (" + e.isShiftDown() + ")"; String newline = "\n"; System.out.println(s + newline + " " + charString + newline + " " + keyCodeString + newline + " " + modString + newline + " " + isString + newline); }
Example 7
Source File: KeyBindingOverrideKeyEventDispatcher.java From ghidra with Apache License 2.0 | 2 votes |
/** * A test to see if the given event is modified in such a way as a text component would not * handle the event * @param e the event * @return true if modified */ private boolean isModified(KeyEvent e) { return e.isAltDown() || e.isAltGraphDown() || e.isMetaDown() || e.isControlDown(); }