note about Java Robot
最近在寫KeyEvent相關的程式,所以...還是要筆記一下 從JDK 1.3開始,Java提供一個可以產生input event的class - java.awt.robot ... "This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed." ... 它提供了一些api,例如: keyPress(int keycode)/keyRelease(int keycode) mouseMove(int x, int y) mousePress(int buttons)/mouseRelease(int buttons) 讓我們可以模擬產生keyboard和mouse的event 而相關的keycode如下: keycode in Android KeyEvent & keycode in Java KeyEvent