org.sikuli.api.robot.desktop
Class DesktopScreen

java.lang.Object
  extended by org.sikuli.api.robot.desktop.DesktopScreen
All Implemented Interfaces:
Screen

public class DesktopScreen
extends Object
implements Screen

The DesktopScreen class defines methods for retrieving properties of the connected screen(s).


Constructor Summary
DesktopScreen(int screenId)
          Constructs a new DesktopScreen whose screen id is specified by the screenId argument.
 
Method Summary
 Rectangle getBounds()
          Returns the bounding Rectangle of this DesktopScreen.
 int getId()
          Returns screen id of this DesktopScreen.
static int getNumberScreens()
          Gets the number of screens available on the desktop.
static DesktopScreen getScreenAtCoord(int x, int y)
          Determines and returns the DesktopScreen of the specified (x,y) coordinates.
 int getScreenId()
           
 BufferedImage getScreenshot(int x, int y, int width, int height)
          Creates and returns an image containing a screen capture of the specified arguments of the same name.
 Dimension getSize()
          Gets the size of this Screen, represented by the returned Dimension.
 String toString()
          Returns a String representation of this DesktopScreen and its values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DesktopScreen

public DesktopScreen(int screenId)
Constructs a new DesktopScreen whose screen id is specified by the screenId argument. The specified screen id represents the order of the connected screen. For example, in a dual monitor setup, a screenId of 0 refers to the main display and 1 to the secondary display.

Parameters:
screenId - the screen id.
Method Detail

getScreenshot

public BufferedImage getScreenshot(int x,
                                   int y,
                                   int width,
                                   int height)
Description copied from interface: Screen
Creates and returns an image containing a screen capture of the specified arguments of the same name. x, y, width, height should be within the bounds.

Specified by:
getScreenshot in interface Screen
Parameters:
x - the X location of the screen coordinate.
y - the Y location of the screen coordinate.
width - The width of the region to be captured.
height - The height of the region to be captured.
Returns:
The captured image.
Throws:
IOException - If an input or output exception occurred.

getSize

public Dimension getSize()
Description copied from interface: Screen
Gets the size of this Screen, represented by the returned Dimension.

Specified by:
getSize in interface Screen
Returns:
a Dimension, representing the size of this Screen.

getId

public int getId()
Returns screen id of this DesktopScreen.

Returns:
the screen id.

getBounds

public Rectangle getBounds()
Returns the bounding Rectangle of this DesktopScreen.

Returns:
a Rectangle object that represents the bounding of this DesktopScreen.

getScreenAtCoord

public static DesktopScreen getScreenAtCoord(int x,
                                             int y)
Determines and returns the DesktopScreen of the specified (x,y) coordinates.

Parameters:
x - the X coordinate.
y - the Y coordinate.
Returns:
returns DesktopScreen of the specified coordinates, or null if the coordinates reside outside of all available screens.

toString

public String toString()
Returns a String representation of this DesktopScreen and its values.

Overrides:
toString in class Object
Returns:
a String representing this DesktopScreen object's screen id.

getNumberScreens

public static int getNumberScreens()
Gets the number of screens available on the desktop.

Returns:
the number of connected screens.

getScreenId

public int getScreenId()


Copyright © 2014. All rights reserved.