Java Code Examples for java.awt.event.KeyEvent#VK_KANA_LOCK

The following examples show how to use java.awt.event.KeyEvent#VK_KANA_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 hottub with GNU General Public License v2.0 5 votes vote down vote up
@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: WToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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 3
Source File: WToolkit.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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: XToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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 6
Source File: XToolkit.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@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 7
Source File: WToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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 8
Source File: LWCToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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 9
Source File: WToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 10
Source File: LWCToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 11
Source File: WToolkit.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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 12
Source File: LWCToolkit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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: XToolkit.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@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 14
Source File: WToolkit.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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: WToolkit.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@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: LWCToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 17
Source File: WToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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: Toolkit.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the state of the given locking key on the keyboard.
 * 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}.
 * <p>
 * Depending on the platform, setting the state of a locking key may
 * involve event processing and therefore may not be immediately
 * observable through getLockingKeyState.
 *
 * @param  keyCode the key code
 * @param  on the state of the key
 * @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 setting 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 void setLockingKeyState(int keyCode, boolean on)
    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.setLockingKeyState");
    }
    throw new UnsupportedOperationException("Toolkit.setLockingKeyState");
}
 
Example 20
Source File: Toolkit.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * 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");
}