实现每隔3秒自动按↑间后再按Enter(确定键)
如何实现?

解决方案 »

  1.   

    你的问题有点笼统,是在什么情况下?网页?还是什么?而且如果是后台处理的话只能是你想另一种办法去模拟这个事件的触发,可以选择有定时功能的一些框架。如果是web上面这个如果不是浏览器运行的怎么处理?而是通过前端js之类的来处理。
      

  2.   

    很多游戏.如我打完了一段话.按↑键就显示你刚刚发言的话..像CS也有得..dos命令也有!
      

  3.   

    j2me?
    是的话使用
    TimeTask
    定时去触发键盘的事件就可以了;
    相应的方法可以写在 keypressed事件里面。
      

  4.   

    Robot r = new Robot();
    // 按键
    r.keyPress(51);
    // 释放
    r.keyRelease(51);
    Thread.sleep(time);robot 用于自动化测试 。  可以挂在当前程序上运行。
      

  5.   


    package com.qiu.paint;import java.awt.AWTException;
    import java.awt.Robot;
    import java.awt.event.KeyEvent;/**
     *
     * @author QiuLingdong
     *
     */
    public class AutoPressKey implements Runnable {
    private Robot robot;
    private Thread thread; private AutoPressKey() throws AWTException, InterruptedException {
    robot = new Robot();
    thread
    = new Thread(this);
    thread.start();
    } public void run() {
    System.out.println("我按了哦!");
    robot.keyPress(KeyEvent.VK_UP);
    robot.keyRelease(KeyEvent.VK_UP);
    robot.keyPress(KeyEvent.VK_ENTER);
    robot.keyRelease(KeyEvent.VK_ENTER);
    }
    public static void main(String[] args) throws AWTException,
    InterruptedException {
    AutoPressKey demo = new AutoPressKey(); }
    }
    修改一下,加个定时器就可以了