APIdia Launch Partner
Top Inners Fields Constructors Methods
com.sun.glass.ui.headless

public Class HeadlessRobot

extends GlassRobot
Class Inheritance
Imports
com.sun.glass.events.KeyEvent, .MouseEvent, com.sun.glass.ui.Application, .GlassRobot, .Window, java.util.Arrays, .HashSet, .List, javafx.scene.image.WritableImage, javafx.scene.input.KeyCode, .MouseButton, javafx.scene.paint.Color

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
private HeadlessWindow
private final HeadlessApplication
private final HeadlessRobot.MouseState
private double
private double
pack-priv final int
pack-priv final int
private final char[]
private final HeadlessRobot.SpecialKeys
Inherited from com.sun.glass.ui.GlassRobot:
MOUSE_BACK_BTNMOUSE_FORWARD_BTNMOUSE_LEFT_BTNMOUSE_MIDDLE_BTNMOUSE_RIGHT_BTN

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
public void
create()

Implements abstract com.sun.glass.ui.GlassRobot.create.

Initializes any state necessary for this Robot.

public void
destroy()

Implements abstract com.sun.glass.ui.GlassRobot.destroy.

Frees any resources allocated by this Robot.

private HeadlessWindow
pack-priv int
pack-priv int
private char[]
getKeyChars(int key)

private int
pack-priv int
public double
getMouseX()

Implements abstract com.sun.glass.ui.GlassRobot.getMouseX.

Returns the current mouse x-position.

public double
getMouseY()

Implements abstract com.sun.glass.ui.GlassRobot.getMouseY.

Returns the current mouse y-position.

public Color
getPixelColor(double x, double y)

Implements abstract com.sun.glass.ui.GlassRobot.getPixelColor.

Returns the Color of the pixel at the screen coordinates relative to the primary screen specified by location.

public WritableImage
getScreenCapture(WritableImage image, double x, double y, double width, double height, boolean scaleToFit)

Overrides com.sun.glass.ui.GlassRobot.getScreenCapture.

Returns an Image containing the specified rectangular area of the screen.

public void
getScreenCapture(int x, int y, int width, int height, int[] data, boolean scaleToFit)

Overrides com.sun.glass.ui.GlassRobot.getScreenCapture.

Captures the specified rectangular area of the screen and uses it to fill the given data array with the raw pixel data.

private HeadlessWindow
getTargetWindow(double x, double y)

private HeadlessWindow
public void
keyPress(KeyCode keyCode)

Implements abstract com.sun.glass.ui.GlassRobot.keyPress.

Presses the specified KeyCode key.

public void
keyRelease(KeyCode keyCode)

Implements abstract com.sun.glass.ui.GlassRobot.keyRelease.

Releases the specified KeyCode key.

public void
mouseMove(double x, double y)

Implements abstract com.sun.glass.ui.GlassRobot.mouseMove.

Moves the mouse to the specified (x,y) screen coordinates relative to the primary screen.

public void
mousePress(MouseButton... buttons)

Implements abstract com.sun.glass.ui.GlassRobot.mousePress.

Presses the specified MouseButtons.

public void
mouseRelease(MouseButton... buttons)

Implements abstract com.sun.glass.ui.GlassRobot.mouseRelease.

Releases the specified MouseButtons.

public void
mouseWheel(int wheelAmt)

Implements abstract com.sun.glass.ui.GlassRobot.mouseWheel.

Scrolls the mouse wheel by the specified amount of wheel clicks.

private void
processSpecialKeys(int c, boolean on)

pack-priv void
pack-priv void
Inherited from com.sun.glass.ui.GlassRobot:
convertFromIntArgbconvertFromPixelsconvertToRobotMouseButton

Field Detail

activeWindowback to summary
private HeadlessWindow activeWindow
applicationback to summary
private final HeadlessApplication application
mouseStateback to summary
private final HeadlessRobot.MouseState mouseState
mouseXback to summary
private double mouseX
mouseYback to summary
private double mouseY
multiplierXback to summary
pack-priv final int multiplierX
multiplierYback to summary
pack-priv final int multiplierY
NO_CHARback to summary
private final char[] NO_CHAR
specialKeysback to summary
private final HeadlessRobot.SpecialKeys specialKeys

Constructor Detail

HeadlessRobotback to summary
public HeadlessRobot(HeadlessApplication application)

Method Detail

checkActiveWindowExistsback to summary
private void checkActiveWindowExists()
checkWindowEnterExitback to summary
private void checkWindowEnterExit()
checkWindowFocusedback to summary
private void checkWindowFocused()
createback to summary
public void create()

Implements abstract com.sun.glass.ui.GlassRobot.create.

Doc from com.sun.glass.ui.GlassRobot.create.

Initializes any state necessary for this Robot. Called by the Robot constructor.

Annotations
@Override
destroyback to summary
public void destroy()

Implements abstract com.sun.glass.ui.GlassRobot.destroy.

Doc from com.sun.glass.ui.GlassRobot.destroy.

Frees any resources allocated by this Robot.

Annotations
@Override
getFocusedWindowback to summary
private HeadlessWindow getFocusedWindow()
getGlassEventButtonback to summary
pack-priv int getGlassEventButton(MouseButton[] buttons)
getGlassEventButtonback to summary
pack-priv int getGlassEventButton(MouseButton button)
getKeyCharsback to summary
private char[] getKeyChars(int key)
getKeyModifiersback to summary
private int getKeyModifiers()
getModifiersback to summary
pack-priv int getModifiers(MouseButton... buttons)
getMouseXback to summary
public double getMouseX()

Implements abstract com.sun.glass.ui.GlassRobot.getMouseX.

Doc from com.sun.glass.ui.GlassRobot.getMouseX.

Returns the current mouse x-position.

Annotations
@Override
getMouseYback to summary
public double getMouseY()

Implements abstract com.sun.glass.ui.GlassRobot.getMouseY.

Doc from com.sun.glass.ui.GlassRobot.getMouseY.

Returns the current mouse y-position.

Annotations
@Override
getPixelColorback to summary
public Color getPixelColor(double x, double y)

Implements abstract com.sun.glass.ui.GlassRobot.getPixelColor.

Doc from com.sun.glass.ui.GlassRobot.getPixelColor.

Returns the Color of the pixel at the screen coordinates relative to the primary screen specified by location. Regardless of the scale of the screen (Screen#getOutputScaleX(), Screen#getOutputScaleY()), this method only samples a single pixel. For example, on a HiDPI screen with output scale 2, the screen unit at the point (x,y) may have 4 pixels. In this case the color returned is the color of the top, left pixel. Color values are not averaged when a screen unit is made up of more than one pixel.

Annotations
@Override
getScreenCaptureback to summary
public WritableImage getScreenCapture(WritableImage image, double x, double y, double width, double height, boolean scaleToFit)

Overrides com.sun.glass.ui.GlassRobot.getScreenCapture.

Doc from com.sun.glass.ui.GlassRobot.getScreenCapture.

Returns an Image containing the specified rectangular area of the screen.

If the scaleToFit argument is false, the returned Image object dimensions may differ from the requested width and height depending on how many physical pixels the area occupies on the screen. E.g. in HiDPI mode on the Mac (aka Retina display) the pixels are doubled, and thus a screen capture of an area of size (10x10) pixels will result in an Image with dimensions (20x20). Calling code should use the returned images's {@link Image#getWidth() and {@link Image#getHeight() methods to determine the actual image size.

If scaleToFit is true, the returned Image is of the requested size. Note that in this case the image will be scaled in order to fit to the requested dimensions if necessary such as when running on a HiDPI display.

Annotations
@Override
getScreenCaptureback to summary
public void getScreenCapture(int x, int y, int width, int height, int[] data, boolean scaleToFit)

Overrides com.sun.glass.ui.GlassRobot.getScreenCapture.

Doc from com.sun.glass.ui.GlassRobot.getScreenCapture.

Captures the specified rectangular area of the screen and uses it to fill the given data array with the raw pixel data. The data is in RGBA format where each pixel in the image is encoded as 4 bytes - one for each color component of each pixel. If this method is not overridden by subclasses then getScreenCapture(WritableImage, double, double, double, double, boolean) must be overridden to not call this method.

Annotations
@Override
getTargetWindowback to summary
private HeadlessWindow getTargetWindow(double x, double y)
getTopWindowback to summary
private HeadlessWindow getTopWindow()
keyPressback to summary
public void keyPress(KeyCode keyCode)

Implements abstract com.sun.glass.ui.GlassRobot.keyPress.

Doc from com.sun.glass.ui.GlassRobot.keyPress.

Presses the specified KeyCode key.

Annotations
@Override
keyReleaseback to summary
public void keyRelease(KeyCode keyCode)

Implements abstract com.sun.glass.ui.GlassRobot.keyRelease.

Doc from com.sun.glass.ui.GlassRobot.keyRelease.

Releases the specified KeyCode key.

Annotations
@Override
mouseMoveback to summary
public void mouseMove(double x, double y)

Implements abstract com.sun.glass.ui.GlassRobot.mouseMove.

Doc from com.sun.glass.ui.GlassRobot.mouseMove.

Moves the mouse to the specified (x,y) screen coordinates relative to the primary screen.

Annotations
@Override
mousePressback to summary
public void mousePress(MouseButton... buttons)

Implements abstract com.sun.glass.ui.GlassRobot.mousePress.

Doc from com.sun.glass.ui.GlassRobot.mousePress.

Presses the specified MouseButtons.

Annotations
@Override
mouseReleaseback to summary
public void mouseRelease(MouseButton... buttons)

Implements abstract com.sun.glass.ui.GlassRobot.mouseRelease.

Doc from com.sun.glass.ui.GlassRobot.mouseRelease.

Releases the specified MouseButtons.

Annotations
@Override
mouseWheelback to summary
public void mouseWheel(int wheelAmt)

Implements abstract com.sun.glass.ui.GlassRobot.mouseWheel.

Doc from com.sun.glass.ui.GlassRobot.mouseWheel.

Scrolls the mouse wheel by the specified amount of wheel clicks. A positive wheelAmt scrolls the wheel towards the user (down) whereas negative amounts scrolls the wheel away from the user (up).

Annotations
@Override
processSpecialKeysback to summary
private void processSpecialKeys(int c, boolean on)
windowAddedback to summary
pack-priv void windowAdded(HeadlessWindow window)
windowRemovedback to summary
pack-priv void windowRemoved(HeadlessWindow window)
com.sun.glass.ui.headless back to summary

pack-priv Class HeadlessRobot.MouseState

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final HashSet<MouseButton>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pressedButtonsback to summary
pack-priv final HashSet<MouseButton> pressedButtons

Constructor Detail

MouseStateback to summary
pack-priv MouseState()
com.sun.glass.ui.headless back to summary

pack-priv Class HeadlessRobot.SpecialKeys

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

capsLockback to summary
pack-priv boolean capsLock
keyAltback to summary
pack-priv boolean keyAlt
keyCommandback to summary
pack-priv boolean keyCommand
keyControlback to summary
pack-priv boolean keyControl
keyShiftback to summary
pack-priv boolean keyShift
numLockback to summary
pack-priv boolean numLock

Constructor Detail

SpecialKeysback to summary
pack-priv SpecialKeys()