1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17/** 18 * @author Dmitry A. Durnev 19 * @version $Revision$ 20 */ 21package org.apache.harmony.awt.wtk; 22 23import java.awt.Color; 24import java.awt.Rectangle; 25import java.awt.image.BufferedImage; 26 27/** 28 * A cross-platform interface for java.awt.Robot implementation 29 */ 30public interface NativeRobot { 31 32 /** 33 * @see java.awt.Robot#createScreenCapture(Rectangle) 34 * @param screenRect rectangle to capture in screen coordinates 35 * @return the captured image or null if 36 * capture failed. 37 */ 38 BufferedImage createScreenCapture(Rectangle screenRect); 39 40 /** 41 * @see java.awt.Robot#getPixelColor(int, int) 42 */ 43 Color getPixel(int x, int y); 44 45 /** 46 * Generate a native system keyboard input event. 47 * @param keycode A Java virtual key code 48 * @param press A key is pressed if true, released otherwise 49 * @see java.awt.Robot#keyPress(int) 50 * @throws IllegalArgumentException if keycode is invalid in the native system 51 */ 52 void keyEvent(int keycode, boolean press); 53 54 /** 55 * Generate a native system mouse button(s) press or release event. 56 * @param buttons A mask of Java mouse button flags 57 * @param press buttons are pressed if true, released otherwise 58 * @see java.awt.Robot#mousePress(int) 59 */ 60 void mouseButton(int buttons, boolean press); 61 62 /** 63 * Generate a native system mouse motion event. 64 * 65 * @see java.awt.Robot#mouseMove(int, int) 66 */ 67 void mouseMove(int x, int y); 68 69 /** 70 * Generate a native system mouse wheel event. 71 * 72 * @see java.awt.Robot#mouseWheel(int) 73 */ 74 void mouseWheel(int wheelAmt); 75} 76