--- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java 2017-11-06 10:25:22.959131700 +0530 +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java 2017-11-06 10:25:21.952595900 +0530 @@ -166,6 +166,42 @@ } /** + * Presses a given key. + *

+ * Key codes that have more than one physical key associated with them + * (e.g. {@code KeyEvent.VK_SHIFT} could mean either the + * left or right shift key) will map to the left key. + *

+ * Assumes that the + * peer implementations will throw an exception for other bogus + * values e.g. -1, 999999 + * + * @param unicodeKey the unicode key to press. + */ + @Override + public void keyPressUnicode(final int unicodeKey) { + keyEventUnicode(unicodeKey, true); + } + + /** + * Releases a given key. + *

+ * Key codes that have more than one physical key associated with them + * (e.g. {@code KeyEvent.VK_SHIFT} could mean either the + * left or right shift key) will map to the left key. + *

+ * Assumes that the + * peer implementations will throw an exception for other bogus + * values e.g. -1, 999999 + * + * @param unicodeKey the unicode key to release. + */ + @Override + public void keyReleaseUnicode(final int unicodeKey) { + keyEventUnicode(unicodeKey, false); + } + + /** * Returns the color of a pixel at the given screen coordinates. * @param x X position of pixel * @param y Y position of pixel @@ -198,6 +234,7 @@ boolean isButtonsDownState, boolean isMouseMove); private native void keyEvent(int javaKeyCode, boolean keydown); + private native void keyEventUnicode(int unicodeKey, boolean keydown); private void getScreenPixels(Rectangle r, int[] pixels){ double scale = fDevice.getScaleFactor(); nativeGetScreenPixels(r.x, r.y, r.width, r.height, scale, pixels);