< prev index next >

jdk/test/lib/testlibrary/ExtendedRobot.java

Print this page




  31 import java.awt.MouseInfo;
  32 import java.awt.event.InputEvent;
  33 import java.awt.event.KeyEvent;
  34 
  35 /**
  36  * ExtendedRobot is a subclass of {@link java.awt.Robot}. It provides some convenience methods that are
  37  * ought to be moved to {@link java.awt.Robot} class.
  38  * <p>
  39  * ExtendedRobot uses delay {@link #getSyncDelay()} to make syncing threads with {@link #waitForIdle()}
  40  * more stable. This delay can be set once on creating object and could not be changed throughout object
  41  * lifecycle. Constructor reads vm integer property {@code java.awt.robotdelay} and sets the delay value
  42  * equal to the property value. If the property was not set 500 milliseconds default value is used.
  43  * <p>
  44  * When using jtreg you would include this class via something like:
  45  * <pre>
  46  * {@literal @}library ../../../../lib/testlibrary
  47  * {@literal @}build ExtendedRobot
  48  * </pre>
  49  *
  50  * @author      Dmitriy Ermashov
  51  * @since       1.9
  52  */
  53 
  54 public class ExtendedRobot extends Robot {
  55 
  56     private static int DEFAULT_SPEED = 20;       // Speed for mouse glide and click
  57     private static int DEFAULT_SYNC_DELAY = 500; // Default Additional delay for waitForIdle()
  58     private static int DEFAULT_STEP_LENGTH = 2;  // Step length (in pixels) for mouse glide
  59 
  60     private final int syncDelay = DEFAULT_SYNC_DELAY;
  61 
  62     //TODO: uncomment three lines below after moving functionality to java.awt.Robot
  63     //{
  64     //    syncDelay = AccessController.doPrivileged(new GetIntegerAction("java.awt.robotdelay", DEFAULT_SYNC_DELAY));
  65     //}
  66 
  67     /**
  68      * Constructs an ExtendedRobot object in the coordinate system of the primary screen.
  69      *
  70      * @throws  AWTException if the platform configuration does not allow low-level input
  71      *          control. This exception is always thrown when




  31 import java.awt.MouseInfo;
  32 import java.awt.event.InputEvent;
  33 import java.awt.event.KeyEvent;
  34 
  35 /**
  36  * ExtendedRobot is a subclass of {@link java.awt.Robot}. It provides some convenience methods that are
  37  * ought to be moved to {@link java.awt.Robot} class.
  38  * <p>
  39  * ExtendedRobot uses delay {@link #getSyncDelay()} to make syncing threads with {@link #waitForIdle()}
  40  * more stable. This delay can be set once on creating object and could not be changed throughout object
  41  * lifecycle. Constructor reads vm integer property {@code java.awt.robotdelay} and sets the delay value
  42  * equal to the property value. If the property was not set 500 milliseconds default value is used.
  43  * <p>
  44  * When using jtreg you would include this class via something like:
  45  * <pre>
  46  * {@literal @}library ../../../../lib/testlibrary
  47  * {@literal @}build ExtendedRobot
  48  * </pre>
  49  *
  50  * @author      Dmitriy Ermashov
  51  * @since       9
  52  */
  53 
  54 public class ExtendedRobot extends Robot {
  55 
  56     private static int DEFAULT_SPEED = 20;       // Speed for mouse glide and click
  57     private static int DEFAULT_SYNC_DELAY = 500; // Default Additional delay for waitForIdle()
  58     private static int DEFAULT_STEP_LENGTH = 2;  // Step length (in pixels) for mouse glide
  59 
  60     private final int syncDelay = DEFAULT_SYNC_DELAY;
  61 
  62     //TODO: uncomment three lines below after moving functionality to java.awt.Robot
  63     //{
  64     //    syncDelay = AccessController.doPrivileged(new GetIntegerAction("java.awt.robotdelay", DEFAULT_SYNC_DELAY));
  65     //}
  66 
  67     /**
  68      * Constructs an ExtendedRobot object in the coordinate system of the primary screen.
  69      *
  70      * @throws  AWTException if the platform configuration does not allow low-level input
  71      *          control. This exception is always thrown when


< prev index next >