Robot: getPixelColor(int x, int y) : Robot « java.awt « Java by API






Robot: getPixelColor(int x, int y)

 
import java.awt.Color;
import java.awt.Robot;

public class Main {
  public static void main(String[] args) throws Exception{
    Robot robot = new Robot();

    Color color = robot.getPixelColor(20, 20);

    System.out.println("Red   = " + color.getRed());
    System.out.println("Green = " + color.getGreen());
    System.out.println("Blue  = " + color.getBlue());
  }
}

   
  








Related examples in the same category

1.Robot: createScreenCapture(Rectangle screenRect)
2.Robot: keyPress(int keycode)
3.Robot: keyRelease(int keycode)
4.Robot: mouseMove(int x, int y)
5.Robot: mousePress(int buttons)
6.Robot: mouseRelease(int buttons)
7.Robot: mouseWheel(int wheelAmt)