public class InteractionHandler
extends java.awt.Robot
| Constructor and Description |
|---|
InteractionHandler() |
| Modifier and Type | Method and Description |
|---|---|
private void |
click(int button)
Presses and releases the specified mouse button
|
java.awt.Point |
getMousePos()
Gets the absolute position of the mouse.
|
void |
leftClick(java.awt.Point p)
Clicks the left mouse button at the point p
|
void |
mouseWheelClick(java.awt.Point p)
Clicks the mouse wheel at the point p
|
void |
moveMouseTo(int x,
int y)
Repositions the mouse.
|
void |
moveMouseTo(java.awt.Point p)
Repostions the mouse.
|
void |
pressDown()
Presses and releases the down key.
|
void |
pressLeft()
Presses and releases the left key.
|
void |
pressRight()
Presses and releases the right key.
|
void |
pressUp()
Presses and releases the up key.
|
void |
rightClick(java.awt.Point p)
Clicks the right mouse button at the point p
|
void |
type(java.lang.String t,
boolean ret)
Type the given string
|
void |
typeInArea(java.awt.Point p,
java.lang.String t,
boolean ret)
Clicks on a point then types to allow selection of text areas followed by text input
|
public InteractionHandler()
throws java.awt.AWTException
java.awt.AWTExceptionpublic void type(java.lang.String t,
boolean ret)
Types the given string. If ret is true, enter/return will be pressed
after the string is typed.
t - String to typeret - If true enter/return will be pressedpublic void typeInArea(java.awt.Point p,
java.lang.String t,
boolean ret)
Clicks the given point, types the given string and, if ret is true, then presses enter/return
p - Point to click ont - String to typeret - If true enter/return will be pressedpublic void pressUp()
public void pressDown()
public void pressLeft()
public void pressRight()
public void moveMouseTo(int x,
int y)
Repositions the mouse at the absolute coordinates (x, y).
x - X coordinatey - Y coordinatepublic void moveMouseTo(java.awt.Point p)
Repositions the mouse at the absolute coordinates (p.x, p.y).
p - The x and y coordinatespublic java.awt.Point getMousePos()
private void click(int button)
Presses and releases the specified mouse button. Requires that button masks be used. For example, InputEvent.BUTTON1_DOWN_MASK
button - The button to be clickedInputEventpublic void leftClick(java.awt.Point p)
Moves the mouse to p and clicks the left mouse button (InputEvent.BUTTON1_DOWN_MASK)
p - Point to clickpublic void rightClick(java.awt.Point p)
Moves the mouse to p and clicks the right mouse button (InputEvent.BUTTON2_DONW_MASK)
p - Point to clickpublic void mouseWheelClick(java.awt.Point p)
Moves the mouse to p and clicks the mouse wheel (InputEvent.BUTTON3_DOWN_MASK)
p - Point to click