Java Code Examples for java.awt.event.KeyEvent#VK_SCROLL_LOCK
The following examples show how to use
java.awt.event.KeyEvent#VK_SCROLL_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: 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 2
Source File: XToolkit.java From openjdk-jdk8u-backup 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: WToolkit.java From openjdk-jdk8u-backup 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 4
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 5
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 6
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 7
Source File: LWCToolkit.java From openjdk-jdk8u 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: LWCToolkit.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 9
Source File: LWCToolkit.java From dragonwell8_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 10
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 11
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 12
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 13
Source File: WToolkit.java From TencentKona-8 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 14
Source File: WToolkit.java From openjdk-8 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 15
Source File: LWCToolkit.java From TencentKona-8 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 16
Source File: XToolkit.java From hottub 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: WToolkit.java From dragonwell8_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 18
Source File: WToolkit.java From hottub 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: 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; } } }
Example 20
Source File: Toolkit.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * Returns whether the given locking key on the keyboard is currently in * its "on" state. * Valid key codes are * {@link java.awt.event.KeyEvent#VK_CAPS_LOCK VK_CAPS_LOCK}, * {@link java.awt.event.KeyEvent#VK_NUM_LOCK VK_NUM_LOCK}, * {@link java.awt.event.KeyEvent#VK_SCROLL_LOCK VK_SCROLL_LOCK}, and * {@link java.awt.event.KeyEvent#VK_KANA_LOCK VK_KANA_LOCK}. * * @param keyCode the key code * @return {@code true} if the given key is currently in its "on" state; * otherwise {@code false} * @exception java.lang.IllegalArgumentException if {@code keyCode} * is not one of the valid key codes * @exception java.lang.UnsupportedOperationException if the host system doesn't * allow getting the state of this key programmatically, or if the keyboard * doesn't have this key * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.3 */ public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException { GraphicsEnvironment.checkHeadless(); if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK || keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) { throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState"); } throw new UnsupportedOperationException("Toolkit.getLockingKeyState"); }