/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.awt.*; /** * ExtendedRobot is a subclass of {@link Robot}. It provides some convenience methods that are * ought to be moved to {@link Robot} class. *
* ExtendedRobot uses delay {@link #getSyncDelay()} to make syncing threads with {@link #waitForIdle()} * more stable. This delay can be set once on creating object and could not be changed throughout object * lifecycle. Constructor reads vm integer property {@code java.awt.robotdelay} and sets the delay value * equal to the property value. If the property was not set 500 milliseconds default value is used. *
* When using jtreg you would include this class via something like: *
* {@literal @}library ../../../../lib/testlibrary * {@literal @}build ExtendedRobot ** * @author Dmitriy Ermashov * @since 1.9 */ public class ExtendedRobot extends Robot { /** * Constructs an ExtendedRobot 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 java.awt.AWTPermission */ public ExtendedRobot() throws AWTException { super(); } /** * Creates an ExtendedRobot for the given screen device. Coordinates passed * to ExtendedRobot method calls like mouseMove and createScreenCapture will * be interpreted as being in the same coordinate system as the specified screen. * Note that depending on the platform configuration, multiple screens may either: *
* If screen devices are reconfigured such that the coordinate system is * affected, the behavior of existing ExtendedRobot objects is undefined. * * @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 java.awt.AWTPermission */ public ExtendedRobot(GraphicsDevice screen) throws AWTException { super(screen); } }