Examples of Robot


Examples of java.awt.Robot

    public BufferedImage getVideoSurfaceContents() {
        Logger.debug("getVideoSurfaceContents()");
        try {
            Rectangle bounds = videoSurface.canvas().getBounds();
            bounds.setLocation(videoSurface.canvas().getLocationOnScreen());
            return new Robot().createScreenCapture(bounds);
        }
        catch(Exception e) {
            throw new RuntimeException("Failed to get video surface contents", e);
        }
    }
View Full Code Here

Examples of java.awt.Robot

    robotFactory = new RobotFactory();
  }

  @Test
  public void shouldCreateNewRobot() throws AWTException {
    Robot last = null;
    for (int i = 0; i < 6; i++) {
      Robot current = robotFactory.newRobotInPrimaryScreen();
      assertThat(current).isNotNull().isNotSameAs(last);
      last = current;
    }
  }
View Full Code Here

Examples of java.awt.Robot

   * @throws AWTException if the platform configuration does not allow low-level input control. This exception is always
   *           thrown when {@code GraphicsEnvironment.isHeadless()} returns {@code true}.
   * @throws SecurityException if {@code createRobot} permission is not granted.
   */
  public @Nonnull Robot newRobotInPrimaryScreen() throws AWTException {
    return new Robot();
  }
View Full Code Here

Examples of java.awt.Robot

    this(windows, new RobotFactory());
  }

  WindowStatus(@Nonnull Windows windows, @Nonnull RobotFactory robotFactory) {
    this.windows = windows;
    Robot r = null;
    try {
      r = robotFactory.newRobotInPrimaryScreen();
    } catch (AWTException ignored) {
      logger.log(WARNING, "Error ocurred when creating a new Robot", ignored);
    }
View Full Code Here

Examples of java.awt.Robot

  }

  @Before
  public void setUp() throws Exception {
    settings = new Settings();
    robot = new Robot();
  }
View Full Code Here

Examples of java.awt.Robot

    robotFactory = newRobotFactoryMock();
  }

  @Test
  public void should_use_RobotFactory_to_create_AWTRobot() throws AWTException {
    Robot robot = mock(Robot.class);
    when(robotFactory.newRobotInPrimaryScreen()).thenReturn(robot);
    RobotEventGenerator eventGenerator = new RobotEventGenerator(robotFactory, new Settings());
    assertThat(eventGenerator.robot()).isSameAs(robot);
  }
View Full Code Here

Examples of java.awt.Robot

    /* (non-Javadoc)
     * @see de.dfki.km.augmentedtext.browserplugin.services.sessionrecorder.SessionRecorder#storeDeviceInfo(de.dfki.km.augmentedtext.services.trackingdevices.TrackingDeviceInfo)
     */
    void init() {
        try {
            this.robot = new Robot();
        } catch (final AWTException e) {
            e.printStackTrace();
        }

        final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
View Full Code Here

Examples of java.awt.Robot

    /** */
    void init() {

        try {
            this.robot = new Robot();
        } catch (final AWTException e) {
            e.printStackTrace();
        }

        try {
View Full Code Here

Examples of java.awt.Robot

                            aComp.getBounds().Y + ")" + " (" +
                            aComp.getBounds().Width + "," +
                            aComp.getBounds().Height + ")";
            System.out.println("The boundary Rectangle is " + bounds);
                try {
                    Robot rob = new Robot();
                    int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2);
                    int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2);
                    System.out.println("try to click mouse button on x/y " + x + "/" + y);
                    rob.mouseMove(x, y);
                    rob.mousePress(InputEvent.BUTTON1_MASK);
                    rob.mouseRelease(InputEvent.BUTTON1_MASK);
                } catch (java.awt.AWTException e) {
                    System.out.println("couldn't press mouse button");
                }
           
        }
View Full Code Here

Examples of java.awt.Robot

                            aComp.getBounds().Y + ")" + " (" +
                            aComp.getBounds().Width + "," +
                            aComp.getBounds().Height + ")";
            System.out.println("The boundary Rectangle is " + bounds);
                try {
                    Robot rob = new Robot();
                    int x = aComp.getLocationOnScreen().X + (aComp.getBounds().Width / 2);
                    int y = aComp.getLocationOnScreen().Y + (aComp.getBounds().Height / 2);
                    System.out.println("try to double click mouse button on x/y " + x + "/" + y);
                    rob.mouseMove(x, y);
                    rob.mousePress(InputEvent.BUTTON1_MASK);
                    rob.mouseRelease(InputEvent.BUTTON1_MASK);
                    utils.shortWait(100);
                    rob.mousePress(InputEvent.BUTTON1_MASK);
                    rob.mouseRelease(InputEvent.BUTTON1_MASK);
                } catch (java.awt.AWTException e) {
                    System.out.println("couldn't press mouse button");
                }
           
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.