Package java.awt

Examples of java.awt.Robot


  }

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


    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

    /* (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

    /** */
    void init() {

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

        try {
View Full Code Here

                            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

                            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

                                    log.debug("Taking screenshot");
                                    File f = File.createTempFile("screen", ".png",
                                        new File(System.getProperty("java.io.tmpdir")));
                                    Dimension ss = JNodeToolkit.getJNodeToolkit().getScreenSize();
                                    BufferedImage capture =
                                        new Robot().createScreenCapture(new Rectangle(0, 0, ss.width, ss.height));
                                    log.debug("Saving screenshot to " + f);
                                    ImageIO.write(capture, "png", f);
                                    log.debug("Saved " + f);
                                } catch (Exception e) {
                                    log.error("Error taking screenshot", e);
View Full Code Here

        Point location = aCom.getLocationOnScreen();       
        //Point location = (Point) tEnv.getObjRelation("Location");
        //XAccessibleComponent aCom = (XAccessibleComponent) tEnv.getObjRelation("Location");
        //Point location = aCom.getLocationOnScreen();
        try {
            Robot rob = new Robot();
            rob.mouseMove(location.X + 20, location.Y + 10);
            rob.mousePress(InputEvent.BUTTON1_MASK);
            rob.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (java.awt.AWTException e) {
            System.out.println("couldn't adjust scrollbar");
        }

        shortWait();
View Full Code Here

        Point point = window.getLocationOnScreen();
        Rectangle rect = window.getBounds();
       
        log.println("klick mouse button...");
        try {
            Robot rob = new Robot();
            int x = point.X + (rect.Width / 2)+50;
            int y = point.Y + (rect.Height / 2)+50;
            rob.mouseMove(x, y);
            System.out.println("Press Button");
            rob.mousePress(InputEvent.BUTTON3_MASK);
            System.out.println("Release Button");
            rob.mouseRelease(InputEvent.BUTTON3_MASK);
            System.out.println("done");
            System.out.println("warte");
            shortWait();
            System.out.println("Press Button");
            rob.mousePress(InputEvent.BUTTON1_MASK);
            System.out.println("Release Button");
            rob.mouseRelease(InputEvent.BUTTON1_MASK);
            System.out.println("done "+rob.getAutoDelay());           
        } catch (java.awt.AWTException e) {
            log.println("couldn't press mouse button");
        }
               
View Full Code Here

        Point location = aCom.getLocationOnScreen();       
        //Point location = (Point) tEnv.getObjRelation("Location");
        //XAccessibleComponent aCom = (XAccessibleComponent) tEnv.getObjRelation("Location");
        //Point location = aCom.getLocationOnScreen();
        try {
            Robot rob = new Robot();
            rob.mouseMove(location.X + 50, location.Y + 75);
            rob.mousePress(InputEvent.BUTTON1_MASK);
            rob.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (java.awt.AWTException e) {
            System.out.println("couldn't adjust scrollbar");
        }

        shortWait();
View Full Code Here

TOP

Related Classes of java.awt.Robot

Copyright © 2018 www.massapicom. 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.