Examples of keyPress()


Examples of java.awt.Robot.keyPress()

        }

        if (doAction) {
          currentPressedKeys.put(key, true);

          robot.keyPress(key);
        }
      } else if (action.equals("onkeyup")) {
        Robot robot = new Robot();

        int key = getInt(returnMap, "k");
View Full Code Here

Examples of java.awt.Robot.keyPress()

            throw new IllegalArgumentException("No robot");
        }

        // Press Alt + PrintScreen
        // (Windows shortcut to take a screen shot of the active window)
        robot.keyPress(KeyEvent.VK_ALT);
        robot.keyPress(KeyEvent.VK_PRINTSCREEN);
        robot.keyRelease(KeyEvent.VK_PRINTSCREEN);
        robot.keyRelease(KeyEvent.VK_ALT);

        System.out.println("Image copied.");
View Full Code Here

Examples of java.awt.Robot.keyPress()

        }

        // Press Alt + PrintScreen
        // (Windows shortcut to take a screen shot of the active window)
        robot.keyPress(KeyEvent.VK_ALT);
        robot.keyPress(KeyEvent.VK_PRINTSCREEN);
        robot.keyRelease(KeyEvent.VK_PRINTSCREEN);
        robot.keyRelease(KeyEvent.VK_ALT);

        System.out.println("Image copied.");
       
View Full Code Here

Examples of java.awt.Robot.keyPress()

               
                if (isWindows() == false)
                    Thread.sleep(5000);

                Robot roby = new Robot();
                roby.keyPress(KeyEvent.VK_H);
                roby.keyRelease(KeyEvent.VK_H);
                buf.append("h");
               
                String s = getText(bean);
                if ( ! s.equals(buf.toString()))
View Full Code Here

Examples of java.awt.Robot.keyPress()

                roby.waitForIdle();
                roby.mousePress(InputEvent.BUTTON1_MASK);
                roby.waitForIdle();
                roby.mouseRelease(InputEvent.BUTTON1_MASK);
                roby.waitForIdle();
                roby.keyPress(KeyEvent.VK_H);
                roby.waitForIdle();
                roby.keyRelease(KeyEvent.VK_H);
                roby.waitForIdle();

                buf.append("h");
View Full Code Here

Examples of java.awt.Robot.keyPress()

                {
                    roby.mousePress(InputEvent.BUTTON1_MASK);
                    roby.waitForIdle();
                    roby.mouseRelease(InputEvent.BUTTON1_MASK);
                    roby.waitForIdle();
                    roby.keyPress(KeyEvent.VK_H);
                    roby.waitForIdle();
                    roby.keyRelease(KeyEvent.VK_H);
                    roby.waitForIdle();

                    String sH = "h";
View Full Code Here

Examples of java.awt.Robot.keyPress()

        */
        private void keyIntoDoc(){
            try {
                Robot rob = new Robot();
                log.println("try to press 'A'");
                rob.keyPress(java.awt.event.KeyEvent.VK_A);
                rob.keyRelease(java.awt.event.KeyEvent.VK_A);
            } catch (java.awt.AWTException e) {
                log.println("couldn't press key");
            }
           
View Full Code Here

Examples of java.awt.Robot.keyPress()

                    // test is finished.
                    ked = new RemovableKeyEventDispatcher(this);
                    kfm.addKeyEventDispatcher(ked);
                    Robot r = new Robot();
                    isTestingCaps = true;
                    r.keyPress(65);
                    r.keyRelease(65);
                    r.keyPress(KeyEvent.VK_BACK_SPACE);
                    r.keyRelease(KeyEvent.VK_BACK_SPACE);
                } catch (Exception e1) {
                    // this can happen for example due to security reasons in unsigned applets
View Full Code Here

Examples of java.awt.Robot.keyPress()

                    kfm.addKeyEventDispatcher(ked);
                    Robot r = new Robot();
                    isTestingCaps = true;
                    r.keyPress(65);
                    r.keyRelease(65);
                    r.keyPress(KeyEvent.VK_BACK_SPACE);
                    r.keyRelease(KeyEvent.VK_BACK_SPACE);
                } catch (Exception e1) {
                    // this can happen for example due to security reasons in unsigned applets
                    // when we can't test caps lock state programatically bail out silently
View Full Code Here

Examples of java.awt.Robot.keyPress()

        String[] nonkeystr = {
            "VK_B", "VK_1", "VK_ALT",
        };
        for (int i=0;i < keys.length;i++) {
            try {
                robot.keyPress(keys[i]);
                long start = System.currentTimeMillis();
                while (!KeyboardUtils.isPressed(keys[i])) {
                    if (System.currentTimeMillis() - start > 5000) {
                        fail("Timed out waiting for keypress: " + keystr[i]);
                    }
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.