< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CRobot.java

Print this page

        

*** 164,173 **** --- 164,209 ---- public void keyRelease(final int keycode) { keyEvent(keycode, false); } /** + * Presses a given key. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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. + * <p> + * 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 * @return color of the pixel */
*** 196,205 **** --- 232,242 ---- private native void mouseEvent(int displayID, int lastX, int lastY, int buttonsState, 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); } private native void nativeGetScreenPixels(int x, int y, int width, int height, double scale, int[] pixels);
< prev index next >