< prev index next >

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

Print this page

        

*** 47,62 **** * automated testing of Java platform implementations. * <p> * Using the class to generate input events differs from posting * events to the AWT event queue or AWT components in that the * events are generated in the platform's native input ! * queue. For example, <code>Robot.mouseMove</code> will actually move * the mouse cursor instead of just generating mouse move events. * <p> * Note that some platforms require special privileges or extensions * to access low-level input control. If the current platform configuration ! * does not allow input control, an <code>AWTException</code> will be thrown * when trying to construct Robot objects. For example, X-Window systems * will throw the exception if the XTEST 2.2 standard extension is not supported * (or not enabled) by the X server. * <p> * Applications that use Robot for purposes other than self-testing should --- 47,62 ---- * automated testing of Java platform implementations. * <p> * Using the class to generate input events differs from posting * events to the AWT event queue or AWT components in that the * events are generated in the platform's native input ! * queue. For example, {@code Robot.mouseMove} will actually move * the mouse cursor instead of just generating mouse move events. * <p> * Note that some platforms require special privileges or extensions * to access low-level input control. If the current platform configuration ! * does not allow input control, an {@code AWTException} will be thrown * when trying to construct Robot objects. For example, X-Window systems * will throw the exception if the XTEST 2.2 standard extension is not supported * (or not enabled) by the X server. * <p> * Applications that use Robot for purposes other than self-testing should
*** 78,88 **** * Constructs a Robot object in the coordinate system of the primary screen. * * @throws AWTException if the platform configuration does not allow * low-level input control. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true ! * @throws SecurityException if <code>createRobot</code> permission is not granted * @see java.awt.GraphicsEnvironment#isHeadless * @see SecurityManager#checkPermission * @see AWTPermission */ public Robot() throws AWTException { --- 78,88 ---- * Constructs a Robot object in the coordinate system of the primary screen. * * @throws AWTException if the platform configuration does not allow * low-level input control. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true ! * @throws SecurityException if {@code createRobot} permission is not granted * @see java.awt.GraphicsEnvironment#isHeadless * @see SecurityManager#checkPermission * @see AWTPermission */ public Robot() throws AWTException {
*** 111,123 **** * @param screen A screen GraphicsDevice indicating the coordinate * system the Robot will operate in. * @throws AWTException if the platform configuration does not allow * low-level input control. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true. ! * @throws IllegalArgumentException if <code>screen</code> is not a screen * GraphicsDevice. ! * @throws SecurityException if <code>createRobot</code> permission is not granted * @see java.awt.GraphicsEnvironment#isHeadless * @see GraphicsDevice * @see SecurityManager#checkPermission * @see AWTPermission */ --- 111,123 ---- * @param screen A screen GraphicsDevice indicating the coordinate * system the Robot will operate in. * @throws AWTException if the platform configuration does not allow * low-level input control. This exception is always thrown when * GraphicsEnvironment.isHeadless() returns true. ! * @throws IllegalArgumentException if {@code screen} is not a screen * GraphicsDevice. ! * @throws SecurityException if {@code createRobot} permission is not granted * @see java.awt.GraphicsEnvironment#isHeadless * @see GraphicsDevice * @see SecurityManager#checkPermission * @see AWTPermission */
*** 334,351 **** afterEvent(); } /** * Presses a given key. The key should be released using the ! * <code>keyRelease</code> method. * <p> * Key codes that have more than one physical key associated with them ! * (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the * left or right shift key) will map to the left key. * ! * @param keycode Key to press (e.g. <code>KeyEvent.VK_A</code>) ! * @throws IllegalArgumentException if <code>keycode</code> is not * a valid key * @see #keyRelease(int) * @see java.awt.event.KeyEvent */ public synchronized void keyPress(int keycode) { --- 334,351 ---- afterEvent(); } /** * Presses a given key. The key should be released using the ! * {@code keyRelease} method. * <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. * ! * @param keycode Key to press (e.g. {@code KeyEvent.VK_A}) ! * @throws IllegalArgumentException if {@code keycode} is not * a valid key * @see #keyRelease(int) * @see java.awt.event.KeyEvent */ public synchronized void keyPress(int keycode) {
*** 356,370 **** /** * Releases a given key. * <p> * Key codes that have more than one physical key associated with them ! * (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the * left or right shift key) will map to the left key. * ! * @param keycode Key to release (e.g. <code>KeyEvent.VK_A</code>) ! * @throws IllegalArgumentException if <code>keycode</code> is not a * valid key * @see #keyPress(int) * @see java.awt.event.KeyEvent */ public synchronized void keyRelease(int keycode) { --- 356,370 ---- /** * 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. * ! * @param keycode Key to release (e.g. {@code KeyEvent.VK_A}) ! * @throws IllegalArgumentException if {@code keycode} is not a * valid key * @see #keyPress(int) * @see java.awt.event.KeyEvent */ public synchronized void keyRelease(int keycode) {
*** 397,408 **** /** * Creates an image containing pixels read from the screen. This image does * not include the mouse cursor. * @param screenRect Rect to capture in screen coordinates * @return The captured image ! * @throws IllegalArgumentException if <code>screenRect</code> width and height are not greater than zero ! * @throws SecurityException if <code>readDisplayPixels</code> permission is not granted * @see SecurityManager#checkPermission * @see AWTPermission */ public synchronized BufferedImage createScreenCapture(Rectangle screenRect) { checkScreenCaptureAllowed(); --- 397,408 ---- /** * Creates an image containing pixels read from the screen. This image does * not include the mouse cursor. * @param screenRect Rect to capture in screen coordinates * @return The captured image ! * @throws IllegalArgumentException if {@code screenRect} width and height are not greater than zero ! * @throws SecurityException if {@code readDisplayPixels} permission is not granted * @see SecurityManager#checkPermission * @see AWTPermission */ public synchronized BufferedImage createScreenCapture(Rectangle screenRect) { checkScreenCaptureAllowed();
*** 468,489 **** autoWaitForIdle(); autoDelay(); } /** ! * Returns whether this Robot automatically invokes <code>waitForIdle</code> * after generating an event. ! * @return Whether <code>waitForIdle</code> is automatically called */ public synchronized boolean isAutoWaitForIdle() { return isAutoWaitForIdle; } /** ! * Sets whether this Robot automatically invokes <code>waitForIdle</code> * after generating an event. ! * @param isOn Whether <code>waitForIdle</code> is automatically invoked */ public synchronized void setAutoWaitForIdle(boolean isOn) { isAutoWaitForIdle = isOn; } --- 468,489 ---- autoWaitForIdle(); autoDelay(); } /** ! * Returns whether this Robot automatically invokes {@code waitForIdle} * after generating an event. ! * @return Whether {@code waitForIdle} is automatically called */ public synchronized boolean isAutoWaitForIdle() { return isAutoWaitForIdle; } /** ! * Sets whether this Robot automatically invokes {@code waitForIdle} * after generating an event. ! * @param isOn Whether {@code waitForIdle} is automatically invoked */ public synchronized void setAutoWaitForIdle(boolean isOn) { isAutoWaitForIdle = isOn; }
*** 524,535 **** delay(autoDelay); } /** * Sleeps for the specified time. ! * To catch any <code>InterruptedException</code>s that occur, ! * <code>Thread.sleep()</code> may be used instead. * * @param ms time to sleep in milliseconds * @throws IllegalArgumentException if {@code ms} * is not between 0 and 60,000 milliseconds inclusive * @see java.lang.Thread#sleep --- 524,535 ---- delay(autoDelay); } /** * Sleeps for the specified time. ! * To catch any {@code InterruptedException}s that occur, ! * {@code Thread.sleep()} may be used instead. * * @param ms time to sleep in milliseconds * @throws IllegalArgumentException if {@code ms} * is not between 0 and 60,000 milliseconds inclusive * @see java.lang.Thread#sleep
< prev index next >