Java Code Examples for java.awt.AWTKeyStroke#getKeyChar()

The following examples show how to use java.awt.AWTKeyStroke#getKeyChar() . 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: MetaData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 2
Source File: MetaData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 3
Source File: MetaData.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 4
Source File: MetaData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 5
Source File: MetaData.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 6
Source File: MetaData.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 7
Source File: MetaData.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 8
Source File: MetaData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 9
Source File: MetaData.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 10
Source File: MetaData.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 11
Source File: MetaData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 12
Source File: MetaData.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 13
Source File: MetaData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 14
Source File: MetaData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 15
Source File: MetaData.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 16
Source File: MetaData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 17
Source File: MetaData.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
 
Example 18
Source File: MetaData.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}