Package java.awt

Examples of java.awt.Robot.keyPress()


    void cancelMonitorTask() {
        timer.cancel();
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_Q);
            robot.keyRelease(KeyEvent.VK_Q);
            robot.keyPress(KeyEvent.VK_ENTER);
            robot.keyRelease(KeyEvent.VK_ENTER);
        } catch (java.awt.AWTException e) {
            logger.severe(strings.get("awt.error", e.getMessage()));
View Full Code Here


        timer.cancel();
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_Q);
            robot.keyRelease(KeyEvent.VK_Q);
            robot.keyPress(KeyEvent.VK_ENTER);
            robot.keyRelease(KeyEvent.VK_ENTER);
        } catch (java.awt.AWTException e) {
            logger.severe(strings.get("awt.error", e.getMessage()));
        }
    }
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

        if (doAction) {

          this.currentPressedKeys.put(key, true);

          robot.keyPress(key);
        }

      } else if (action.equals("onkeyup")) {

        Robot robot = new Robot();
View Full Code Here

        }

        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

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

        }

        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

            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

        }

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

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.