마우스와 키보드 입력을 자동으로 동작하기 위해 만들어진 듯 하다.
하지만 특정 플랫폼에서 권한관련 문제로 AWTException이 발생할 수 있다고 함
(클래스의 인스턴스 생성시 익셉션 발생함)
매소드 구성을 보니 마우스 매크로 프로그램을 보는 것이 아닌가 싶을 정도로 사용법이 간단하다.
BufferedImage | createScreenCapture(Rectangle screenRect)Creates an image containing pixels read from the screen. |
void | delay(int ms)Sleeps for the specified time. |
int | getAutoDelay()Returns the number of milliseconds this Robot sleeps after generating an event. |
Color | getPixelColor(int x, int y)Returns the color of a pixel at the given screen coordinates. |
boolean | isAutoWaitForIdle()Returns whether this Robot automatically invokes waitForIdle after generating an event. |
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. |
void | setAutoDelay(int ms)Sets the number of milliseconds this Robot sleeps after generating an event. |
void | setAutoWaitForIdle(boolean isOn)Sets whether this Robot automatically invokes waitForIdle after generating an event. |
String | toString()Returns a string representation of this Robot. |
void | waitForIdle()Waits until all events currently on the event queue have been processed. |
간단하긴 하지만 상황에 따라 유용한 클래스라고 생각함!
댓글 없음:
댓글 쓰기