APIdia Launch Partner
Top Description Methods
java.awt.peer

public Interface RobotPeer

Known Direct Implementers
sun.awt.X11.XRobotPeer
Imports
java.awt.Rectangle, .Robot

RobotPeer defines an interface whereby toolkits support automated testing by allowing native input events to be generated from Java code. This interface should not be directly imported by code outside the java.awt.* hierarchy; it is not to be considered public and is subject to change.
Author
Robi Khan

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the RGB value of the specified pixel on screen
getRGBPixel
(int
the X screen coordinate
x
,
int
the Y screen coordinate
y
)

Gets the RGB value of the specified pixel on screen.

public int[]

Returns:

the RGB values of the specified screen area
getRGBPixels
(Rectangle
the screen area to capture the RGB values from
bounds
)

Gets the RGB values of the specified screen area as an array.

public void
keyPress(int
the key code to press
keycode
)

Simulates a key press of the specified key.

public void
keyRelease(int
the key code to release
keycode
)

Simulates a key release of the specified key.

public void
mouseMove(int
the X location on screen
x
,
int
the Y location on screen
y
)

Moves the mouse pointer to the specified screen location.

public void
mousePress(int
the button mask
buttons
)

Simulates a mouse press with the specified button(s).

public void
mouseRelease(int
the button mask
buttons
)

Simulates a mouse release with the specified button(s).

public void
mouseWheel(int
number of notches to move the mouse wheel
wheelAmt
)

Simulates mouse wheel action.

public default boolean

Returns:

true if absolute coordinates should be used, false otherwise
useAbsoluteCoordinates
()

Determines if absolute coordinates should be used by this peer.

Method Detail

getRGBPixelback to summary
public int getRGBPixel(int x, int y)

Gets the RGB value of the specified pixel on screen.

Parameters
x:int

the X screen coordinate

y:int

the Y screen coordinate

Returns:int

the RGB value of the specified pixel on screen

See Also
Robot#getPixelColor(int, int)
getRGBPixelsback to summary
public int[] getRGBPixels(Rectangle bounds)

Gets the RGB values of the specified screen area as an array.

Parameters
bounds:Rectangle

the screen area to capture the RGB values from

Returns:int[]

the RGB values of the specified screen area

See Also
Robot#createScreenCapture(Rectangle)
keyPressback to summary
public void keyPress(int keycode)

Simulates a key press of the specified key.

Parameters
keycode:int

the key code to press

See Also
Robot#keyPress(int)
keyReleaseback to summary
public void keyRelease(int keycode)

Simulates a key release of the specified key.

Parameters
keycode:int

the key code to release

See Also
Robot#keyRelease(int)
mouseMoveback to summary
public void mouseMove(int x, int y)

Moves the mouse pointer to the specified screen location.

Parameters
x:int

the X location on screen

y:int

the Y location on screen

See Also
Robot#mouseMove(int, int)
mousePressback to summary
public void mousePress(int buttons)

Simulates a mouse press with the specified button(s).

Parameters
buttons:int

the button mask

See Also
Robot#mousePress(int)
mouseReleaseback to summary
public void mouseRelease(int buttons)

Simulates a mouse release with the specified button(s).

Parameters
buttons:int

the button mask

See Also
Robot#mouseRelease(int)
mouseWheelback to summary
public void mouseWheel(int wheelAmt)

Simulates mouse wheel action.

Parameters
wheelAmt:int

number of notches to move the mouse wheel

See Also
Robot#mouseWheel(int)
useAbsoluteCoordinatesback to summary
public default boolean useAbsoluteCoordinates()

Determines if absolute coordinates should be used by this peer.

Returns:boolean

true if absolute coordinates should be used, false otherwise