Java Robot keyPressWithCtrl(Robot r, int key)

Here you can find the source of keyPressWithCtrl(Robot r, int key)

Description

key Press With Ctrl

License

Open Source License

Declaration

public static void keyPressWithCtrl(Robot r, int key) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.*;
import java.awt.event.KeyEvent;

public class Main {

    public static void keyPressWithCtrl(Robot r, int key) {
        if (r == null) {
            return;
        }//from   ww  w  .j ava2  s.c  o m
        r.keyPress(KeyEvent.VK_CONTROL);
        r.keyPress(key);
        r.keyRelease(key);
        r.keyRelease(KeyEvent.VK_CONTROL);
        r.delay(100);
    }
}

Related

  1. awtRobotKeyPress(final Robot robot, final int keyCode, final int msDelay)
  2. awtRobotKeyRelease(final Robot robot, final int keyCode, final int msDelay)
  3. keyPress(final int i, final Robot robot, final boolean press, final int keyCode, final int msDelay)
  4. pressKeyCombo(Robot robot, int... codes)