Package org.fest.swing.core
Class RobotEventGenerator
java.lang.Object
org.fest.swing.core.RobotEventGenerator
- All Implemented Interfaces:
InputEventGenerator
Understands input event generation using a AWT
Robot
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRobotEventGenerator
(Settings settings) RobotEventGenerator
(RobotFactory robotFactory, Settings settings) -
Method Summary
Modifier and TypeMethodDescriptionvoid
moveMouse
(int x, int y) Simulates a user moving the mouse pointer to the given coordinates.void
Simulates a user moving the mouse pointer to the given coordinates relative to the given
.Component
void
pressKey
(int keyCode, char keyChar) Simulates a user pressing given key.void
pressMouse
(int buttons) Simulates a user pressing mouse buttons.void
pressMouse
(Component c, Point where, int buttons) Simulates a user pressing the given mouse buttons on the given
.Component
void
pressMouse
(Point where, int buttons) Simulates a user pressing the given mouse buttons on the given coordinates.void
releaseKey
(int keyCode) Simulates a user releasing the given key.void
releaseMouse
(int buttons) Releases the given mouse buttons.(package private) Robot
robot()
void
rotateMouseWheel
(int amount) Rotates the scroll wheel on wheel-equipped mice.
-
Field Details
-
KEY_INPUT_DELAY
private static final int KEY_INPUT_DELAY- See Also:
-
robot
-
settings
-
-
Constructor Details
-
RobotEventGenerator
RobotEventGenerator() -
RobotEventGenerator
RobotEventGenerator(Settings settings) -
RobotEventGenerator
RobotEventGenerator(RobotFactory robotFactory, Settings settings)
-
-
Method Details
-
robot
Robot robot() -
pressMouse
Simulates a user pressing the given mouse buttons on the given
. If the given component isComponent
null
, this method will delegate to
.InputEventGenerator.pressMouse(Point, int)
- Specified by:
pressMouse
in interfaceInputEventGenerator
- Parameters:
c
- theComponent
to click on.where
- the given coordinates, relative to the givenComponent
.buttons
- the mouse buttons to press.
-
pressMouse
Simulates a user pressing the given mouse buttons on the given coordinates.- Specified by:
pressMouse
in interfaceInputEventGenerator
- Parameters:
where
- the coordinates where to press the given mouse buttons.buttons
- the mouse buttons to press.
-
pressMouse
public void pressMouse(int buttons) Simulates a user pressing mouse buttons.- Specified by:
pressMouse
in interfaceInputEventGenerator
- Parameters:
buttons
- the buttons to press.
-
releaseMouse
public void releaseMouse(int buttons) Releases the given mouse buttons.- Specified by:
releaseMouse
in interfaceInputEventGenerator
- Parameters:
buttons
- the mouse buttons to release.
-
rotateMouseWheel
public void rotateMouseWheel(int amount) Rotates the scroll wheel on wheel-equipped mice.- Specified by:
rotateMouseWheel
in interfaceInputEventGenerator
- Parameters:
amount
- number of "notches" to move the mouse wheel. Negative values indicate movement up/away from the user, while positive values indicate movement down/towards the user.
-
moveMouse
Simulates a user moving the mouse pointer to the given coordinates relative to the given
.Component
- Specified by:
moveMouse
in interfaceInputEventGenerator
- Parameters:
c
- the givenComponent
.x
- X coordinate, relative to the givenComponent
.y
- Y coordinate, relative to the givenComponent
.
-
moveMouse
public void moveMouse(int x, int y) Simulates a user moving the mouse pointer to the given coordinates.- Specified by:
moveMouse
in interfaceInputEventGenerator
- Parameters:
x
- X coordinate.y
- Y coordinate.
-
pressKey
public void pressKey(int keyCode, char keyChar) Simulates a user pressing given key.- Specified by:
pressKey
in interfaceInputEventGenerator
- Parameters:
keyCode
- the code of the key to press.keyChar
- the given character.- See Also:
-
releaseKey
public void releaseKey(int keyCode) Simulates a user releasing the given key.- Specified by:
releaseKey
in interfaceInputEventGenerator
- Parameters:
keyCode
- the code of the key to release.- See Also:
-