.
- ! - .
, java.awt.Robot , .
java.awt.Robot, , Alt+Tab, .
, , , :
- ,
Alt+Tab , . - . , , Alt-Tab -count. - - .
, , , Alt-Tab, .
Java , . , Alt+Tab . , , , Alt+Tab , .
, robot.delay() robot.setAutoDelay(), . : , Linux, robot.setAutoDelay(), , , Alt-Tab - .
import java.awt.AWTException;
import java.awt.Robot;
import static java.awt.event.KeyEvent.VK_ALT;
import static java.awt.event.KeyEvent.VK_TAB;
import static java.lang.Integer.parseInt;
public class WindowSwitcher {
public static void main(final String... args) throws AWTException {
final int repeat = args.length != 0 ? parseInt(args[0]) : 1;
final Robot robot = createRobot();
robot.keyPress(VK_ALT);
for (int i = 0; i < repeat; i++) {
robot.keyPress(VK_TAB);
robot.keyRelease(VK_TAB);
robot.delay(500);
}
robot.keyRelease(VK_ALT);
}
public static Robot createRobot() throws AWTException {
final Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(10);
return robot;
}
}