Java Utililty Methods Robot

List of utility methods to do Robot

Description

The list of methods to do Robot are organized into topic(s).

Method

voidawtRobotKeyPress(final Robot robot, final int keyCode, final int msDelay)
awt Robot Key Press
robot.keyPress(keyCode);
robot.delay(msDelay);
voidawtRobotKeyRelease(final Robot robot, final int keyCode, final int msDelay)
awt Robot Key Release
robot.keyRelease(keyCode);
robot.delay(msDelay);
intkeyPress(final int i, final Robot robot, final boolean press, final int keyCode, final int msDelay)
No validation is performed ..
final long t0 = System.currentTimeMillis();
if (press) {
    awtRobotKeyPress(robot, keyCode, msDelay);
} else {
    awtRobotKeyRelease(robot, keyCode, msDelay);
return (int) (System.currentTimeMillis() - t0);
voidkeyPressWithCtrl(Robot r, int key)
key Press With Ctrl
if (r == null) {
    return;
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(key);
r.keyRelease(key);
r.keyRelease(KeyEvent.VK_CONTROL);
r.delay(100);
...
voidpressKeyCombo(Robot robot, int... codes)
press Key Combo
Deque<Integer> keyCodes = new ArrayDeque<Integer>();
for (int code : codes) {
    robot.keyPress(code);
    keyCodes.push(code);
for (int key : keyCodes)
    robot.keyRelease(key);