Class PrivateGlassRobotAdapter

java.lang.Object
org.testfx.service.adapter.impl.GlassRobotAdapter
org.testfx.service.adapter.impl.PrivateGlassRobotAdapter
All Implemented Interfaces:
RobotAdapter

class PrivateGlassRobotAdapter extends GlassRobotAdapter
RobotAdapter implementation that uses the private com.sun.glass.ui.GlassRobot implementation to support JavaFX versions before 11.

All methods are called reflectively so that this class can compile on any JavaFX version.

  • Constructor Details

    • PrivateGlassRobotAdapter

      PrivateGlassRobotAdapter()
  • Method Details

    • robotCreate

      public void robotCreate()
      Description copied from interface: RobotAdapter
      Creates a robot.
    • robotDestroy

      public void robotDestroy()
      Description copied from interface: RobotAdapter
      Destroys the robot
    • keyPress

      public void keyPress(javafx.scene.input.KeyCode key)
      Description copied from interface: RobotAdapter
      Function used to make the robot press a key. The key must be a physical existing key on the keyboard.
      Parameters:
      key - the key to press (must exist on a keyboard)
    • keyRelease

      public void keyRelease(javafx.scene.input.KeyCode key)
      Description copied from interface: RobotAdapter
      Function used to make the robot release a key. The key must be a physical existing key on the keyboard.
      Parameters:
      key - the key to press (must exist on a keyboard)
    • getMouseLocation

      public javafx.geometry.Point2D getMouseLocation()
      Description copied from interface: RobotAdapter
      Returns the current position of the cursor in JavaFx coordinates
      Returns:
      the current position of the mouse cursor
    • mouseMove

      public void mouseMove(javafx.geometry.Point2D location)
      Description copied from interface: RobotAdapter
      Moves the mouse cursor to the given position in JavaFx coordinates
      Parameters:
      location - the location in JavaFx coordinates to move the cursor to
    • mousePress

      public void mousePress(javafx.scene.input.MouseButton button)
      Description copied from interface: RobotAdapter
      Makes the robot press a mouse button.
      Parameters:
      button - the button to press
    • mouseRelease

      public void mouseRelease(javafx.scene.input.MouseButton button)
      Description copied from interface: RobotAdapter
      Makes the robot release a mouse button.
      Parameters:
      button - the button to release
    • getCapturePixelColor

      public javafx.scene.paint.Color getCapturePixelColor(javafx.geometry.Point2D location)
      Description copied from interface: RobotAdapter
      Gets the color of a pixel at the given JavaFx coordinates. The returned Color is in the JavaFx color space. //TODO Due to technical reasons, there might be a deviation in color.
      Parameters:
      location - of the pixel in JavaFx coordinates, to retrieve the color for
      Returns:
      the Color of the given Pixel in the JavaFx color space
    • getScreenCapture

      protected javafx.scene.image.Image getScreenCapture(javafx.geometry.Rectangle2D region, boolean raw)
      Specified by:
      getScreenCapture in class GlassRobotAdapter
    • convertToButtonId

      private int convertToButtonId(javafx.scene.input.MouseButton button)
    • convertFromGlassColor

      private javafx.scene.paint.Color convertFromGlassColor(int color)
    • convertFromGlassPixels

      private javafx.scene.image.Image convertFromGlassPixels(Object glassPixels)
    • writeIntBufferToImage

      private void writeIntBufferToImage(IntBuffer intBuffer, javafx.scene.image.WritableImage image)