Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1063234
  • 博文数量: 284
  • 博客积分: 8223
  • 博客等级: 中将
  • 技术积分: 3188
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-01 13:26
文章分类

全部博文(284)

文章存档

2012年(18)

2011年(33)

2010年(83)

2009年(147)

2008年(3)

分类: Java

2010-08-05 16:16:23

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class test {

    /**
     * @param args
     */

    public static void main(String[] args)throws Exception {
        // TODO Auto-generated method stub

        try {
            Robot robot = new Robot();
            //定义5秒的延迟以便你打开notepad

            // Robot 开始写

            robot.delay(5000);
            robot.keyPress(KeyEvent.VK_H);
            robot.keyPress(KeyEvent.VK_I);
            robot.keyPress(KeyEvent.VK_SPACE);
            robot.keyPress(KeyEvent.VK_C);
            robot.keyPress(KeyEvent.VK_A);
            robot.keyPress(KeyEvent.VK_O);
            robot.keyPress(KeyEvent.VK_E);
            robot.keyPress(KeyEvent.VK_R);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


阅读(1570) | 评论(0) | 转发(0) |
0

上一篇:swing-6-表格

下一篇:个人建站指南

给主人留下些什么吧!~~