Java Code Examples for java.awt.event.KeyEvent#VK_NUM_LOCK
The following examples show how to use
java.awt.event.KeyEvent#VK_NUM_LOCK .
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: WToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } return getLockingKeyStateNative(key); }
Example 2
Source File: XToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 3
Source File: XToolkit.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 4
Source File: WToolkit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public void setLockingKeyState(int key, boolean on) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.setLockingKeyState"); } setLockingKeyStateNative(key, on); }
Example 5
Source File: WToolkit.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } return getLockingKeyStateNative(key); }
Example 6
Source File: LWCToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException { switch (keyCode) { case KeyEvent.VK_NUM_LOCK: case KeyEvent.VK_SCROLL_LOCK: case KeyEvent.VK_KANA_LOCK: throw new UnsupportedOperationException("Toolkit.getLockingKeyState"); case KeyEvent.VK_CAPS_LOCK: return isCapsLockOn(); default: throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } }
Example 7
Source File: LWCToolkit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException { switch (keyCode) { case KeyEvent.VK_NUM_LOCK: case KeyEvent.VK_SCROLL_LOCK: case KeyEvent.VK_KANA_LOCK: throw new UnsupportedOperationException("Toolkit.getLockingKeyState"); case KeyEvent.VK_CAPS_LOCK: return isCapsLockOn(); default: throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } }
Example 8
Source File: WToolkit.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } return getLockingKeyStateNative(key); }
Example 9
Source File: WToolkit.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void setLockingKeyState(int key, boolean on) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.setLockingKeyState"); } setLockingKeyStateNative(key, on); }
Example 10
Source File: XToolkit.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 11
Source File: XToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 12
Source File: WToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } return getLockingKeyStateNative(key); }
Example 13
Source File: LWCToolkit.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException { switch (keyCode) { case KeyEvent.VK_NUM_LOCK: case KeyEvent.VK_SCROLL_LOCK: case KeyEvent.VK_KANA_LOCK: throw new UnsupportedOperationException("Toolkit.getLockingKeyState"); case KeyEvent.VK_CAPS_LOCK: return isCapsLockOn(); default: throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } }
Example 14
Source File: XToolkit.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 15
Source File: WToolkit.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } return getLockingKeyStateNative(key); }
Example 16
Source File: XToolkit.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 17
Source File: XToolkit.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } awtLock(); try { return getModifierState( key ); } finally { awtUnlock(); } }
Example 18
Source File: WToolkit.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean getLockingKeyState(int key) { if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK || key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } return getLockingKeyStateNative(key); }
Example 19
Source File: MacKeymapUtil.java From consulo with Apache License 2.0 | 4 votes |
public static String getKeyText(int code) { switch (code) { case KeyEvent.VK_BACK_SPACE: return BACKSPACE; case KeyEvent.VK_ESCAPE: return ESCAPE; case KeyEvent.VK_CAPS_LOCK: return CAPS_LOCK; case KeyEvent.VK_TAB: return TAB; case KeyEvent.VK_SPACE: return SPACE; case KeyEvent.VK_DELETE: return DELETE; case KeyEvent.VK_HOME: return HOME; case KeyEvent.VK_END: return END; case KeyEvent.VK_PAGE_UP: return PAGE_UP; case KeyEvent.VK_PAGE_DOWN: return PAGE_DOWN; case KeyEvent.VK_UP: return UP; case KeyEvent.VK_DOWN: return DOWN; case KeyEvent.VK_LEFT: return LEFT; case KeyEvent.VK_RIGHT: return RIGHT; case KeyEvent.VK_NUM_LOCK: return NUMBER_LOCK; case KeyEvent.VK_ENTER: return RETURN; case KeyEvent.VK_BACK_QUOTE: return "`"; case KeyEvent.VK_NUMBER_SIGN: return NUM_PAD; case KeyEvent.VK_MULTIPLY: return NUM_PAD + " *"; case KeyEvent.VK_ADD: return "+"; case KeyEvent.VK_SEPARATOR: return ","; case KeyEvent.VK_SUBTRACT: return "-"; case KeyEvent.VK_DECIMAL: return "."; case KeyEvent.VK_DIVIDE: return "/"; case KeyEvent.VK_NUMPAD0: return "0"; case KeyEvent.VK_NUMPAD1: return "1"; case KeyEvent.VK_NUMPAD2: return "2"; case KeyEvent.VK_NUMPAD3: return "3"; case KeyEvent.VK_NUMPAD4: return "4"; case KeyEvent.VK_NUMPAD5: return "5"; case KeyEvent.VK_NUMPAD6: return "6"; case KeyEvent.VK_NUMPAD7: return "7"; case KeyEvent.VK_NUMPAD8: return "8"; case KeyEvent.VK_NUMPAD9: return "9"; case KeyEvent.VK_SLASH: return "/"; case KeyEvent.VK_BACK_SLASH: return "\\"; case KeyEvent.VK_PERIOD: return "."; case KeyEvent.VK_SEMICOLON: return ";"; case KeyEvent.VK_CLOSE_BRACKET: return "]"; case KeyEvent.VK_OPEN_BRACKET: return "["; case KeyEvent.VK_EQUALS: return "="; case KeyEvent.VK_MINUS: return "-"; case KeyEvent.VK_PLUS: return "+"; case 0: return "fn"; } return KeyEvent.getKeyText(code); }
Example 20
Source File: StaffApplication.java From RemoteSupportTool with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("Duplicates") protected synchronized void doHandleKeyPress(KeyEvent e) { if (handler == null) return; //LOGGER.debug("key pressed: " + e.paramString()); // Get code of the pressed key. // Keypad arrows are translated to regular arrow keys. final int keyCode; switch (e.getKeyCode()) { case KeyEvent.VK_KP_DOWN: keyCode = KeyEvent.VK_DOWN; break; case KeyEvent.VK_KP_LEFT: keyCode = KeyEvent.VK_LEFT; break; case KeyEvent.VK_KP_RIGHT: keyCode = KeyEvent.VK_RIGHT; break; case KeyEvent.VK_KP_UP: keyCode = KeyEvent.VK_UP; break; default: keyCode = e.getKeyCode(); break; } // Never press undefined key codes. if (keyCode == KeyEvent.VK_UNDEFINED) { return; } // Never send caps lock, num lock and scroll lock key. if (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK || keyCode == KeyEvent.VK_SCROLL_LOCK) { return; } // Detect, if a control key was pressed. final boolean isControlKey = e.isActionKey() || keyCode == KeyEvent.VK_BACK_SPACE || keyCode == KeyEvent.VK_DELETE || keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_SPACE || keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ESCAPE || keyCode == KeyEvent.VK_ALT || keyCode == KeyEvent.VK_ALT_GRAPH || keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_SHIFT || keyCode == KeyEvent.VK_META; // Press control keys. if (isControlKey) { //LOGGER.debug("press key \"{}\" ({})", keyCode, KeyEvent.getKeyText(keyCode)); handler.sendKeyPress(keyCode); e.consume(); } // Press other keys, if they are pressed together with a modifier key. else if (e.isControlDown() || e.isMetaDown() || windowsKeyDown || (!SystemUtils.IS_OS_MAC && e.isAltDown())) { //LOGGER.debug("press key \"{}\" ({})", keyCode, KeyEvent.getKeyText(keyCode)); handler.sendKeyPress(keyCode); if (!pressedKeys.contains(keyCode)) pressedKeys.add(keyCode); e.consume(); } // Remember, that the Windows key was pressed. if (keyCode == KeyEvent.VK_WINDOWS) { synchronized (Frame.this) { windowsKeyDown = true; } } }