Exemplo n.º 1
0
  public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    robot.setAutoDelay(350);

    SwingUtilities.invokeAndWait(
        new Runnable() {

          public void run() {
            createAndShowGUI();
          }
        });

    robot.waitForIdle();

    SwingUtilities.invokeAndWait(
        new Runnable() {

          public void run() {
            spane.requestFocus();
            sbar.setValue(sbar.getMaximum());
          }
        });

    robot.waitForIdle();

    Point point = getClickPoint(0.5, 0.5);
    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);

    robot.waitForIdle();

    SwingUtilities.invokeAndWait(
        new Runnable() {

          public void run() {
            final int oldValue = sbar.getValue();
            sbar.addAdjustmentListener(
                new AdjustmentListener() {

                  public void adjustmentValueChanged(AdjustmentEvent e) {
                    if (e.getValue() >= oldValue) {
                      passed = false;
                    }
                    do_test = true;
                  }
                });
          }
        });

    robot.waitForIdle();

    point = getClickPoint(0.5, 0.2);
    robot.mouseMove(point.x, point.y);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.waitForIdle();

    if (!do_test || !passed) {
      throw new Exception("The scrollbar moved with incorrect direction");
    }
  }
Exemplo n.º 2
0
  private void execOffThreadWithOnThreadEventDispatch(Runnable testAction) throws Exception {
    _testMouseListener.setModifierCheckEnabled(false);
    _robot.setAutoDelay(MS_ROBOT_AUTO_DELAY);
    {
      // Make sure all the buttons and modifier keys are released.
      clearKeyboadAndMouse();
    }
    _testMouseListener.setModifierCheckEnabled(true);

    Throwable throwable = null;
    // final Object sync = new Object();
    final RunnableTask rt = new RunnableTask(testAction, null, true, System.err);
    try {
      // synchronized(sync) {
      new Thread(rt, "Test-Thread").start();
      int i = 0;
      while (!rt.isExecuted() && null == throwable) {
        System.err.println("WAIT-till-done: eventDispatch() #" + i++);
        eventDispatch();
      }
      if (null == throwable) {
        throwable = rt.getThrowable();
      }
      if (null != throwable) {
        throw new RuntimeException(throwable);
      }
      // }
    } finally {
      System.err.println("WAIT-till-done: DONE");
      _testMouseListener.setModifierCheckEnabled(false);
      clearKeyboadAndMouse();
    }
  }
Exemplo n.º 3
0
  public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new NimbusLookAndFeel());

    Robot robot = new Robot();
    robot.setAutoDelay(50);

    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            createAndShowGUI();
          }
        });

    toolkit.realSync();

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            Component previewPanel =
                Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel");
            point = previewPanel.getLocationOnScreen();
          }
        });

    point.translate(5, 5);

    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
  }
Exemplo n.º 4
0
  public static void main(final String[] args) throws AWTException {
    final boolean dump = Boolean.parseBoolean(args[0]);
    final Window w =
        new Frame() {
          @Override
          public void list(final PrintStream out, final int indent) {
            super.list(out, indent);
            dumped = true;
          }
        };
    w.setSize(200, 200);
    w.setLocationRelativeTo(null);
    w.setVisible(true);

    final Robot robot = new Robot();
    robot.setAutoDelay(50);
    robot.setAutoWaitForIdle(true);
    robot.mouseMove(w.getX() + w.getWidth() / 2, w.getY() + w.getHeight() / 2);
    robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_SHIFT);
    robot.keyPress(KeyEvent.VK_F1);
    robot.keyRelease(KeyEvent.VK_F1);
    robot.keyRelease(KeyEvent.VK_SHIFT);
    robot.keyRelease(KeyEvent.VK_CONTROL);

    w.dispose();
    if (dumped != dump) {
      throw new RuntimeException("Exp:" + dump + ", actual:" + dumped);
    }
  }
Exemplo n.º 5
0
  public static void main(String[] argv) throws AWTException {
    final JFrame f = new JFrame("Robot Test");
    final JButton b = new JButton("Click me");
    final JTextField tf = new JTextField();
    final RobotTest t = new RobotTest();
    f.add(tf, BorderLayout.NORTH);
    f.add(t, BorderLayout.CENTER);
    f.add(b, BorderLayout.SOUTH);
    f.pack();
    f.setLocation(0, 0);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            f.dispose();
          }
        });
    f.setVisible(true);

    final Robot r = new Robot();
    r.setAutoDelay(50);
    r.delay(1000);
    image = r.createScreenCapture(new Rectangle(0, 0, 200, 200));
    t.repaint();
    //        for(int i = 0; i < 400; i++){
    //            r.mouseMove(i, i);
    //        }

    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            tf.setText("Clicked !");
          }
        });

    moveToCenterOfComponent(r, b);
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.mouseRelease(InputEvent.BUTTON1_MASK);

    Point p = f.getLocationOnScreen();
    p.translate(f.getWidth() / 2, 5);
    r.mouseMove((int) p.getX(), (int) p.getY());
    r.mousePress(InputEvent.BUTTON1_MASK);
    for (int i = 0; i < 100; i++) {
      r.mouseMove((int) p.getX() + i, (int) p.getY() + i);
    }
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    t.addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseMoved(MouseEvent event) {
            Point p = event.getPoint();
            SwingUtilities.convertPointToScreen(p, t);
            crtColor = r.getPixelColor(p.x, p.y);
            // Graphics g = t.getGraphics();
            // g.setColor(crtColor);
            // g.fillRect(25,225, 50,50);
            t.repaint();
          }
        });
  }
Exemplo n.º 6
0
 public MouseController() throws AWTException {
   // auto delay after each events
   robot.setAutoDelay(40);
   robot.setAutoWaitForIdle(true);
   robot.delay(5000);
   this.drawSomething();
   this.drawCercle(new Point(846, 467), new Point(992, 603));
   this.drawCercle(new Point(100, 100), new Point(300, 300));
   this.drawCercle(new Point(500, 500), new Point(900, 200));
 }
Exemplo n.º 7
0
  @Override
  protected boolean performTest() {
    try {
      SwingUtilities.invokeAndWait(
          new Runnable() {
            public void run() {
              // prepare test data
              frameClicked = 0;

              b.requestFocus();

              scrollPane.getHorizontalScrollBar().setUnitIncrement(40);
              scrollPane.getVerticalScrollBar().setUnitIncrement(40);

              hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen();
              hLoc.translate(scrollPane.getHorizontalScrollBar().getWidth() - 3, 3);
              vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen();
              vLoc.translate(3, scrollPane.getVerticalScrollBar().getHeight() - 3);

              testLoc = p.getLocationOnScreen();
              testLoc.translate(-3, -3);

              resizeLoc = f.getLocationOnScreen();
              resizeLoc.translate(f.getWidth() - 1, f.getHeight() - 1);
            }
          });
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("Problem preparing test GUI.");
    }
    // run robot
    Robot robot = Util.createRobot();
    robot.setAutoDelay(ROBOT_DELAY);

    robot.mouseMove(hLoc.x, hLoc.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    Util.waitForIdle(robot);

    robot.mouseMove(vLoc.x, vLoc.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    Util.waitForIdle(robot);

    clickAndBlink(robot, testLoc, false);
    robot.mouseMove(resizeLoc.x, resizeLoc.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseMove(resizeLoc.x + 5, resizeLoc.y + 5);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    Util.waitForIdle(robot);

    clickAndBlink(robot, testLoc, false);
    return frameClicked == 2;
  }
  public static void main(String[] args) throws Exception {
    robot = new Robot();
    robot.setAutoDelay(50);

    try {
      SwingUtilities.invokeAndWait(
          new Runnable() {
            @Override
            public void run() {
              createAndShowGUI();
            }
          });

      robot.waitForIdle();

      checkFocusOwner(textField);

      robot.keyPress(KeyEvent.VK_TAB);
      robot.keyRelease(KeyEvent.VK_TAB);
      robot.waitForIdle();

      checkFocusOwner(button);

      robot.keyPress(KeyEvent.VK_SHIFT);
      robot.keyPress(KeyEvent.VK_TAB);
      robot.keyRelease(KeyEvent.VK_TAB);
      robot.keyRelease(KeyEvent.VK_SHIFT);
      robot.waitForIdle();

      checkFocusOwner(textField);

      robot.keyPress(KeyEvent.VK_SHIFT);
      robot.keyPress(KeyEvent.VK_TAB);
      robot.keyRelease(KeyEvent.VK_TAB);
      robot.keyRelease(KeyEvent.VK_SHIFT);
      robot.waitForIdle();

      checkFocusOwner(button);
    } finally {
      SwingUtilities.invokeLater(
          new Runnable() {
            @Override
            public void run() {
              if (frame != null) {
                frame.dispose();
              }
            }
          });
    }
    System.out.println("Test Passed!");
  }
  public static void main(String s[]) {

    // Getting save directory
    String saveDir;
    if (s.length > 0) {
      saveDir = s[0];
    } else {
      saveDir =
          JOptionPane.showInputDialog(
              null,
              "Please enter directory where "
                  + "the images is/will be saved\n\n"
                  + "Also possible to specifiy as argument 1 when "
                  + "running this program.",
              "l:\\webcamtest");
    }

    String layout = "";
    if (s.length > 1) {
      layout = s[1];
    }

    // Move mouse to the point 5000,5000 px (out of the screen)
    Robot rob;
    try {
      rob = new Robot();
      rob.setAutoDelay(500); // 0,5 s
      rob.mouseMove(5000, 5000);
    } catch (AWTException e) {
      e.printStackTrace();
    }

    // Make the main window
    JFrame frame = new JFrame();
    frame.setAlwaysOnTop(true);
    frame.setTitle(
        "Webcam capture and imagefading - "
            + "Vitenfabrikken Jærmuseet - "
            + "made by Hallvard Nygård - "
            + "Vitenfabrikken.no / Jaermuseet.no");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setUndecorated(true);

    WebcamCaptureAndFadePanel panel = new WebcamCaptureAndFadePanel(saveDir, layout);
    frame.getContentPane().add(panel);
    frame.addKeyListener(panel);
    frame.pack();

    frame.setVisible(true);
  }
Exemplo n.º 10
0
  public void ClickingLogic(int Ammount, int delay) {
    robot.mouseMove(var_coordX, var_coordY);
    robot.setAutoDelay(40);
    robot.setAutoWaitForIdle(true);

    for (int i = 0; i < Ammount; i++) {
      // robot.mouseMove(var_coordX,var_coordY); to include or not to include
      robot.delay(delay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      var_ammount++;
      scene_ClickCount.setText(String.valueOf(var_ammount));
    }
  }
 public void init() {
   try {
     robot = new Robot();
     robot.setAutoDelay(50);
   } catch (AWTException e) {
     throw new RuntimeException("Error: unable to create robot", e);
   }
   // Create instructions for the user here, as well as set up
   // the environment -- set the layout manager, add buttons,
   // etc.
   this.setLayout(new BorderLayout());
   Sysout.createDialogWithInstructions(
       new String[] {"Automatic test. Simply wait until it's done."});
 }
Exemplo n.º 12
0
  public static void main(String[] args) throws Throwable {
    Robot robot = new Robot();
    robot.setAutoDelay(250);

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    SwingUtilities.invokeAndWait(
        new Runnable() {

          @Override
          public void run() {
            JFrame frame = new JFrame("Test");
            frame.setContentPane(createPanel(frame));
            frame.setJMenuBar(createMenuBar());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
          }
        });

    robot.waitForIdle();

    // Change the default button to
    // force a call to BasicRootPaneUI.updateDefaultButtonBindings()
    Util.hitKeys(robot, KeyEvent.VK_TAB);

    // If the bug exists, then as soon as the menu appears,
    // the VK_ENTER, VK_DOWN, VK_UP and VK_ESC will have no
    // effect.
    Util.hitMnemonics(robot, KeyEvent.VK_U);
    Util.hitKeys(robot, KeyEvent.VK_ENTER);
    robot.waitForIdle();

    checkAction();

    Util.hitMnemonics(robot, KeyEvent.VK_U);
    Util.hitKeys(robot, KeyEvent.VK_DOWN);
    Util.hitKeys(robot, KeyEvent.VK_ENTER);
    robot.waitForIdle();

    checkAction();
  }
Exemplo n.º 13
0
  public static void main(String[] args) throws Exception {

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    Robot robot = new Robot();
    robot.setAutoDelay(20);
    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            // just to quickly grab a column model
            JTable table = new JTable(10, 5);
            header = new JTableHeader(table.getColumnModel());
            checkColumn(0, "A");
            JFrame frame = new JFrame("standalone header");
            frame.add(header);
            frame.pack();
            frame.setVisible(true);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          }
        });
    robot.waitForIdle();
    Point point = header.getLocationOnScreen();
    robot.mouseMove(point.x + 3, point.y + 3);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    for (int i = 0; i < header.getWidth() - 3; i++) {
      robot.mouseMove(point.x + i, point.y + 3);
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            TableColumnModel model = header.getColumnModel();
            checkColumn(model.getColumnCount() - 1, "A");
          }
        });
  }
Exemplo n.º 14
0
  private void _releaseModifiers() {

    if (_robot != null) {

      _robot.setAutoDelay(MS_ROBOT_AUTO_DELAY);

      boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled();
      _testMouseListener.setModifierCheckEnabled(false);

      {
        _robot.keyRelease(java.awt.event.KeyEvent.VK_SHIFT);
        _robot.keyRelease(java.awt.event.KeyEvent.VK_CONTROL);
        // _robot.keyRelease( java.awt.event.KeyEvent.VK_META ) ;
        // _robot.keyRelease( java.awt.event.KeyEvent.VK_ALT ) ;
        // _robot.keyRelease( java.awt.event.KeyEvent.VK_ALT_GRAPH ) ;

        for (int n = 0; n < _awtButtonMasks.length; ++n) {
          _robot.mouseRelease(_awtButtonMasks[n]);
        }
      }

      _testMouseListener.setModifierCheckEnabled(modifierCheckEnabled);
    }
  }
Exemplo n.º 15
0
 public bug8136998() throws AWTException {
   robot = new Robot();
   robot.setAutoDelay(200);
 }
Exemplo n.º 16
0
 private static void initScreens(boolean reset) {
   if (genv != null && !reset) {
     return;
   }
   genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
   gdevs = genv.getScreenDevices();
   gdevsBounds = new Rectangle[gdevs.length];
   screens = new Screen[gdevs.length];
   if (gdevs.length == 0) {
     Debug.error("Screen: initScreens: GraphicsEnvironment has no screens");
     SikuliX.endFatal(999);
   }
   primaryScreen = -1;
   for (int i = 0; i < getNumberScreens(); i++) {
     gdevsBounds[i] = gdevs[i].getDefaultConfiguration().getBounds();
     if (gdevsBounds[i].contains(new Point(0, 0))) {
       if (primaryScreen < 0) {
         primaryScreen = i;
         log(lvl, "initScreens: ScreenDevice %d contains (0,0) --- will be used as primary", i);
       } else {
         log(lvl, "initScreens: ScreenDevice %d too contains (0,0)!", i);
       }
     }
   }
   if (primaryScreen < 0) {
     Debug.log(
         "Screen: initScreens: no ScreenDevice contains (0,0) --- using first ScreenDevice as primary");
     primaryScreen = 0;
   }
   for (int i = 0; i < screens.length; i++) {
     screens[i] = new Screen(i, true);
     screens[i].initScreen();
   }
   try {
     mouseRobot = new Robot();
     mouseRobot.setAutoDelay(10);
   } catch (AWTException e) {
     Debug.error("Can't initialize global Robot for Mouse: " + e.getMessage());
     SikuliX.endFatal(999);
   }
   if (!reset) {
     log(lvl - 1, "initScreens: basic initialization (%d Screen(s) found)", gdevs.length);
     log(lvl, "*** monitor configuration (primary: %d) ***", primaryScreen);
     for (int i = 0; i < gdevs.length; i++) {
       log(lvl, "%d: %s", i, screens[i].toStringShort());
     }
     log(lvl, "*** end monitor configuration ***");
   }
   if (0 < getNumberScreens()) {
     Location lnow = Mouse.at();
     float mmd = Settings.MoveMouseDelay;
     Settings.MoveMouseDelay = 0f;
     Screen s0 = Screen.getPrimaryScreen();
     Location lc = null, lcn = null;
     for (Screen s : screens) {
       try {
         lc = s.getCenter();
         s0.hover(lc);
         lcn = Mouse.at();
       } catch (Exception ex) {
       }
       if (!lc.equals(lcn)) {
         log(
             lvl,
             "*** multimonitor click check: %s center: (%d, %d) --- NOT OK:  (%d, %d)",
             s.toStringShort(),
             lc.x,
             lc.y,
             lcn.x,
             lcn.y);
       } else {
         log(lvl + 1, "*** checking: %s center: (%d, %d) --- OK", s.toStringShort(), lc.x, lc.y);
       }
     }
     try {
       s0.hover(lnow);
     } catch (FindFailed ex) {
     }
     Settings.MoveMouseDelay = mmd;
   }
 }
Exemplo n.º 17
0
  MovableMouse() throws AWTException {
    this.robot = new Robot();

    robot.setAutoWaitForIdle(true);
    robot.setAutoDelay(autoDelay);
  }
Exemplo n.º 18
0
 /** @param robot robot to use. */
 public void setRobot(Robot robot) {
   robot.setAutoDelay(getAutoDelay());
   this.robot = robot;
 }
Exemplo n.º 19
0
  public static void main(String[] args) throws Throwable {

    sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit();

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            test = new TaskbarPositionTest();
          }
        });

    // Use Robot to automate the test
    Robot robot;
    robot = new Robot();
    robot.setAutoDelay(125);

    // 1 - menu
    Util.hitMnemonics(robot, KeyEvent.VK_1);

    toolkit.realSync();
    isPopupOnScreen(menu1.getPopupMenu(), screenBounds);

    // 2 menu with sub menu
    robot.keyPress(KeyEvent.VK_RIGHT);
    robot.keyRelease(KeyEvent.VK_RIGHT);
    Util.hitMnemonics(robot, KeyEvent.VK_S);

    toolkit.realSync();
    isPopupOnScreen(menu2.getPopupMenu(), screenBounds);

    robot.keyPress(KeyEvent.VK_ENTER);
    robot.keyRelease(KeyEvent.VK_ENTER);

    // Focus should go to non editable combo box
    toolkit.realSync();
    Thread.sleep(500);

    robot.keyPress(KeyEvent.VK_DOWN);

    // How do we check combo boxes?

    // Editable combo box
    robot.keyPress(KeyEvent.VK_TAB);
    robot.keyRelease(KeyEvent.VK_TAB);
    robot.keyPress(KeyEvent.VK_DOWN);
    robot.keyRelease(KeyEvent.VK_DOWN);

    // combo1.getUI();

    // Popup from Text field
    robot.keyPress(KeyEvent.VK_TAB);
    robot.keyRelease(KeyEvent.VK_TAB);
    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_DOWN);
    robot.keyRelease(KeyEvent.VK_DOWN);
    robot.keyRelease(KeyEvent.VK_CONTROL);

    // Popup from a mouse click.
    Point pt = new Point(2, 2);
    SwingUtilities.convertPointToScreen(pt, panel);
    robot.mouseMove((int) pt.getX(), (int) pt.getY());
    robot.mousePress(InputEvent.BUTTON3_MASK);
    robot.mouseRelease(InputEvent.BUTTON3_MASK);

    toolkit.realSync();
    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            test.setLocation(-30, 100);
            combo1.addPopupMenuListener(new ComboPopupCheckListener());
            combo1.requestFocus();
          }
        });

    robot.keyPress(KeyEvent.VK_DOWN);
    robot.keyRelease(KeyEvent.VK_DOWN);
    robot.keyPress(KeyEvent.VK_ESCAPE);
    robot.keyRelease(KeyEvent.VK_ESCAPE);

    toolkit.realSync();
    Thread.sleep(500);
  }
Exemplo n.º 20
0
 public RobotManager(UrcServer application) throws AWTException {
   this.application = application;
   robot = new Robot();
   robot.setAutoDelay(10);
   eventThread = Executors.newSingleThreadExecutor();
 }
Exemplo n.º 21
0
  /**
   * Run through our command list and invoke each command.
   *
   * @see papertoolkit.actions.Action#invoke()
   */
  public void invoke() {
    // need to get a local Robot every time, because we may have sent this across the wire...
    final Robot rob = getRobot();

    // for each method in our list, invoke it with the correct arguments
    for (RobotCommand command : commandsToRun) {
      Object[] arguments = command.arguments;
      RobotMethod method = command.method;

      // System.out.println("RobotAction: Invoking " + method + " [" +
      // ArrayUtils.toString(arguments));
      switch (method) {
        case CREATE_SCREEN_CAPTURE: // args: rectangle, file
          BufferedImage image = rob.createScreenCapture((Rectangle) arguments[0]);
          // save the file locally
          ImageUtils.writeImageToJPEG(image, 100, (File) arguments[1]);
          // System.out.println("RobotAction :: Screen Cap Saved");
          break;
        case DELAY: // args: int milliseconds
          rob.delay((Integer) arguments[0]);
          break;
        case GET_PIXEL_COLOR: // args: int x, int y
          final Color pixelColor =
              rob.getPixelColor((Integer) arguments[0], (Integer) arguments[1]);
          System.out.println(
              "RobotAction :: Pixel Color at "
                  + arguments[0]
                  + ","
                  + arguments[1]
                  + " is "
                  + pixelColor);
          // TODO: Do something more interesting with this data
          break;
        case KEY_PRESS: // arg: int keycode to press
          rob.keyPress((Integer) arguments[0]);
          break;
        case KEY_RELEASE: // arg: int keycode to release
          rob.keyRelease((Integer) arguments[0]);
          break;
        case MOUSE_MOVE: // args: int x, int y
          // System.out.println("RobotAction :: Moving Mouse... to " + arguments[0] + "," +
          // arguments[1] + "!");
          rob.mouseMove((Integer) arguments[0], (Integer) arguments[1]);
          break;
        case MOUSE_PRESS: // int mouse button
          rob.mousePress((Integer) arguments[0]);
          break;
        case MOUSE_RELEASE: // int mouse button
          rob.mouseRelease((Integer) arguments[0]);
          break;
        case MOUSE_WHEEL: // int wheel roll amount
          rob.mouseWheel((Integer) arguments[0]);
          break;
        case SET_AUTO_DELAY: // int delay millis
          rob.setAutoDelay((Integer) arguments[0]);
          break;
        case SET_AUTO_WAIT_FOR_IDLE: // boolean wait?
          rob.setAutoWaitForIdle((Boolean) arguments[0]);
          break;
        case WAIT_FOR_IDLE:
          rob.waitForIdle();
          break;
      }
    }
  }
Exemplo n.º 22
0
 private void updateRobotAutoDelay() {
   robot.setAutoDelay(delayBetweenEvents);
 }