|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.safs.robot.Robot
public class Robot
Utility functions for common user interactions on the system.
Robot,
CreateUnicodeMap,
JunwuMa SEP 23, 2008 Added doEvents(Robot, Vector) running RobotClipboardPasteEvent with proper delay time
for ctrl+v(paste) job done.
CANAGL MAR 25, 2009 Added MouseDrag support
CANAGL APR 03, 2009 Enhance MouseDrag support to work for more apps.
LeiWang JUL 04, 2011 Add methods to maximize, minimize, restore, close window by key-mnemonic.| Constructor Summary | |
|---|---|
Robot()
|
|
| Method Summary | |
|---|---|
static java.lang.Object |
centerDrag(java.awt.Point start,
java.awt.Point end)
Move the mouse cursor to the specified start Point coordinates then perform a single mousePress (Button2) and drag\move then Release the mouse button at the end point. |
static java.lang.Object |
click(int x,
int y)
Move the mouse cursor to the specified x,y coordinates then perform a single mousePress and Release to execute a Click. |
static java.lang.Object |
click(int x,
int y,
int buttonmask,
int nclicks)
Workhorse Click routine. |
static java.lang.Object |
click(java.awt.Point p)
Move the mouse cursor to the specified Point coordinates then perform a single mousePress and Release to execute a Click. |
static java.lang.Object |
clickWithKeyPress(int x,
int y,
int buttonmask,
int keycode,
int nclicks)
Workhorse Click with Keypress routine. |
static void |
closeFocusedWindow()
Pre-condition: The window should be focused Minimize window by mnemonic key 'C' of window-system-menu. This works only for windows system. |
static java.lang.Object |
doubleClick(int x,
int y)
Move the mouse cursor to the specified x,y coordinates then perform a single mousePress and Release to execute a Click. |
static java.lang.Object |
doubleClick(java.awt.Point p)
Move the mouse cursor to the specified Point coordinates then perform a single mousePress and Release to execute a Click. |
static InputKeysParser |
getInputKeysParser()
Retrieve the active InputKeysParser. |
protected static java.net.URL |
getResourceURL(java.lang.Class clazz,
java.lang.String aresource)
|
static java.awt.Robot |
getRobot()
Retrieve the active java.awt.Robot from the JVM. |
static void |
getWindowSystemMenu()
Pre-condition: The window should be focused Get the window system menu by short-cut 'Alt+Space' This works only for windows system. |
static java.lang.Object |
inputChars(java.lang.String input)
Type keyboard input characters unmodified. |
static java.lang.Object |
inputKeys(java.lang.String input)
Type keyboard input. |
static java.lang.Object |
leftDrag(java.awt.Point start,
java.awt.Point end)
Move the mouse cursor to the specified start Point coordinates then perform a single mousePress (Button1) and drag\move then Release the mouse button at the end point. |
static void |
maximizeFocusedWindow()
Pre-condition: The window should be focused Minimize window by mnemonic key 'x' of window-system-menu. This works only for windows system. |
static void |
minimizeAllWindows()
Minimize all windows by the short cut 'Windows+M' This works only for windows system. |
static void |
minimizeFocusedWindow()
Pre-condition: The window should be focused Minimize window by mnemonic key 'n' of window-system-menu. This works only for windows system. |
static java.lang.Object |
mouseDrag(java.awt.Point start,
java.awt.Point end,
int buttonMasks)
Move the mouse cursor to the specified start Point coordinates then perform a single mousePress using buttonMasks and drag\move then Release the mouse button at the end point. |
static void |
restoreFocusedWindow()
Pre-condition: The window should be focused Minimize window by mnemonic key 'R' of window-system-menu. This works only for windows system. |
static java.lang.Object |
rightClick(int x,
int y)
Move the mouse cursor to the specified x,y coordinates then perform a single mousePress and Release to execute a RightClick. |
static java.lang.Object |
rightClick(java.awt.Point p)
Move the mouse cursor to the specified Point coordinates then perform a single mousePress and Release to execute a Click. |
static java.lang.Object |
rightDrag(java.awt.Point start,
java.awt.Point end)
Move the mouse cursor to the specified start Point coordinates then perform a single mousePress (Button3) and drag\move then Release the mouse button at the end point. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Robot()
| Method Detail |
|---|
public static java.awt.Robot getRobot()
throws java.awt.AWTException
java.awt.AWTExceptionpublic static InputKeysParser getInputKeysParser()
InputKeysParser
protected static java.net.URL getResourceURL(java.lang.Class clazz,
java.lang.String aresource)
public static java.lang.Object inputKeys(java.lang.String input)
throws java.awt.AWTException
input - -- the String of characters to enter.
java.awt.AWTException - -- if there is a problem instantiating or using the
java.awt.RobotInputKeysParser,
Robot
public static java.lang.Object inputChars(java.lang.String input)
throws java.awt.AWTException
input - -- the String of characters to enter.
java.awt.AWTException - -- if there is a problem instantiating or using the
java.awt.RobotInputKeysParser,
Robot
public static java.lang.Object click(int x,
int y,
int buttonmask,
int nclicks)
throws java.awt.AWTException
x - screen X coordinatey - screen Y coordinatebuttonmask - -- specific InputEvent.BUTTONn_MASK(s)nclicks - -- number of times to click (press and release)
java.awt.AWTExceptionRobot.mousePress(int),
InputEvent.BUTTON1_MASK
public static java.lang.Object clickWithKeyPress(int x,
int y,
int buttonmask,
int keycode,
int nclicks)
throws java.awt.AWTException
x - screen X coordinatey - screen Y coordinatebuttonmask - -- specific InputEvent.BUTTONn_MASK(s)keycode - -- specific keycode to press & release. Ex: KeyEvent.VK_SHIFTnclicks - -- number of times to click (press and release)
java.awt.AWTExceptionRobot.mousePress(int),
InputEvent.BUTTON1_MASK
public static java.lang.Object click(int x,
int y)
throws java.awt.AWTException
x - y -
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot
public static java.lang.Object doubleClick(int x,
int y)
throws java.awt.AWTException
x - y -
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot
public static java.lang.Object rightClick(int x,
int y)
throws java.awt.AWTException
x - y -
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot
public static java.lang.Object click(java.awt.Point p)
throws java.awt.AWTException
Point -
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot,
click(int, int)
public static java.lang.Object rightClick(java.awt.Point p)
throws java.awt.AWTException
Point -
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot,
click(int, int)
public static java.lang.Object doubleClick(java.awt.Point p)
throws java.awt.AWTException
Point -
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot,
click(int, int)
public static java.lang.Object mouseDrag(java.awt.Point start,
java.awt.Point end,
int buttonMasks)
throws java.awt.AWTException
Point - screen coordinates to start of mouse press and drag.Point - screen coordinates to end mouse drag and mouse release.int - button masks to use during drag
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot
public static java.lang.Object leftDrag(java.awt.Point start,
java.awt.Point end)
throws java.awt.AWTException
Point - screen coordinates to start of mouse press and drag.Point - screen coordinates to end mouse drag and mouse release.
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot,
mouseDrag(Point,Point,int)
public static java.lang.Object rightDrag(java.awt.Point start,
java.awt.Point end)
throws java.awt.AWTException
Point - screen coordinates to start of mouse press and drag.Point - screen coordinates to end mouse drag and mouse release.
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot
public static java.lang.Object centerDrag(java.awt.Point start,
java.awt.Point end)
throws java.awt.AWTException
Point - screen coordinates to start of mouse press and drag.Point - screen coordinates to end mouse drag and mouse release.
java.awt.AWTException - if instantiating java.awt.Robot throws it.Robot
public static void minimizeAllWindows()
throws java.awt.AWTException
java.awt.AWTException
public static void getWindowSystemMenu()
throws java.awt.AWTException
java.awt.AWTException
public static void minimizeFocusedWindow()
throws java.awt.AWTException
java.awt.AWTException
public static void maximizeFocusedWindow()
throws java.awt.AWTException
java.awt.AWTException
public static void restoreFocusedWindow()
throws java.awt.AWTException
java.awt.AWTException
public static void closeFocusedWindow()
throws java.awt.AWTException
java.awt.AWTException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||