Package java.awt

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


                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

                {
                    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

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

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

                    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

        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

          Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(k);
          try
          {
            Robot r = new Robot();
            inputFile.requestFocus();
            r.keyPress(KeyEvent.VK_ENTER);
            r.keyRelease(KeyEvent.VK_ENTER);
          }
          catch(Exception exc)
          {
            if(Constants.debug)
View Full Code Here

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

        */
        private void keyIntoDoc(){
            try {
                Robot rob = new Robot();
                System.out.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) {
                System.out.println("couldn't press key");
            }
           
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.