< prev index next >

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

Print this page
rev 17492 : temp changes commit

@@ -164,10 +164,46 @@
     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 keycode the key to press (e.g. {@code KeyEvent.VK_A})
+     */
+    @Override
+    public void keyPressUnicode(final int key) {
+        keyEventUnicode(key, 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 keycode the key to release (e.g. {@code KeyEvent.VK_A})
+     */
+    @Override
+    public void keyReleaseUnicode(final int key) {
+        keyEventUnicode(key, 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,10 +232,11 @@
     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 javaKeyCode, 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 >