Robot類別提供以下幾個方法來模擬滑鼠動作:
public void mouseMove(int x, int y); // 螢幕位置
/*java.awt.event.InputEvent.BUTTON1_MASK 代表左鍵
* java.awt.event.InputEvent.BUTTON2_MASK 代表中鍵
* java.awt.event.InputEvent.BUTTON3_MASK 代表右鍵*/
public void mousePress(int buttons);
public void mouseRelease(int buttons); //同上
/* 滾輪的轉動量 正值為向前轉,負值為向後轉。*/
public void mouseWheel(int wheelAmt);
詳細API
http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html
沒有留言:
張貼留言