< prev index next >
src/java.desktop/share/classes/java/awt/Robot.java
Print this page
rev 17492 : temp changes commit
*** 375,384 ****
--- 375,417 ----
checkKeycodeArgument(keycode);
peer.keyRelease(keycode);
afterEvent();
}
+ /**
+ * Presses a given unicode key. The key should be released using the
+ * {@code keyReleaseUnicode} method.
+ * <p>
+ *
+ * @param key unicode to press
+ * @throws IllegalArgumentException if {@code key} is not
+ * a valid unicode key
+ * @see #keyReleaseUnicode(int)
+ * @see java.awt.event.KeyEvent
+ */
+ public synchronized void keyPressUnicode(int key) {
+ checkKeycodeArgument(key);
+ peer.keyPressUnicode(key);
+ afterEvent();
+ }
+
+ /**
+ * Releases a given unicode key.
+ * <p>
+ *
+ * @param key unicode to release
+ * @throws IllegalArgumentException if {@code key} is not a
+ * valid key
+ * @see #keyPressUnicode(int)
+ * @see java.awt.event.KeyEvent
+ */
+ public synchronized void keyReleaseUnicode(int key) {
+ checkKeycodeArgument(key);
+ peer.keyReleaseUnicode(key);
+ 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 >