用什么类可以控制鼠标或键盘的动作? 谢谢!

解决方案 »

  1.   

    java.awt.Robot 可以移动鼠标,模拟击键,模拟键盘
      

  2.   

    Robot这个类很有趣:还能捕捉屏幕,取得屏幕上某点的颜色值.
    void keyPress(int keycode) 
              Presses a given key. 
     void keyRelease(int keycode) 
              Releases a given key. 
     void mouseMove(int x, int y) 
              Moves mouse pointer to given screen coordinates. 
     void mousePress(int buttons) 
              Presses one or more mouse buttons. 
     void mouseRelease(int buttons) 
              Releases one or more mouse buttons. 
     void mouseWheel(int wheelAmt) 
              Rotates the scroll wheel on wheel-equipped mice.