码迷,mamicode.com
首页 > 编程语言 > 详细

java.awt.Robot

时间:2015-11-12 13:43:33      阅读:321      评论:0      收藏:0      [点我收藏+]

标签:

 1 import java.awt.AWTException;
 2 import java.awt.Robot;
 3 import java.awt.event.KeyEvent;
 4 
 5 public class TestRobot {
 6     Robot man;
 7 
 8     public static void main(String[] args) throws AWTException {
 9         new TestRobot();
10     }
11 
12     public TestRobot() throws AWTException {
13         man = new Robot();
14         man.mouseMove(300, 300);
15         String s = "weidwiao is great";
16         int k = KeyEvent.VK_A;
17         for (char i : s.toCharArray()) {
18             if (Character.isAlphabetic(i))
19                 i = Character.toUpperCase(i);
20             else if(Character.isSpaceChar(i))
21                 i=KeyEvent.VK_SPACE; 
22             man.keyPress(i);
23             man.keyRelease(i);
24             man.delay(1000);
25         }
26     }
27 }

 

java.awt.Robot

标签:

原文地址:http://www.cnblogs.com/weidiao/p/4958637.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!