< prev index next >

src/java.desktop/share/classes/java/awt/Robot.java

Print this page

        

*** 375,384 **** --- 375,405 ---- checkKeycodeArgument(keycode); peer.keyRelease(keycode); afterEvent(); } + /** + * Presses and releases a given unicode key. The key should be released + * using the {@code keyPressUnicode} and {@code keyReleaseUnicode} method. + * <p> + * + * @param unicodeKey unicode key to press and release + * @throws IllegalArgumentException if {@code unicodeKey} is not + * a valid unicode key + * @see #keyPressUnicode(int) + * @see #keyReleaseUnicode(int) + */ + public synchronized void keyUnicode(int unicodeKey) { + checkKeycodeArgument(unicodeKey); + + peer.keyPressUnicode(unicodeKey); + afterEvent(); + + peer.keyReleaseUnicode(unicodeKey); + afterEvent(); + } + private void checkKeycodeArgument(int keycode) { // rather than build a big table or switch statement here, we'll // just check that the key isn't VK_UNDEFINED and assume that the // peer implementations will throw an exception for other bogus // values e.g. -1, 999999
< prev index next >