Get the colour of a screen pixel : Robot « Development Class « Java

Get the colour of a screen pixel

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.Moving the Cursor on the Screen
2.Simulate a key press
3.Simulate a mouse click
4.Create mouse event using Robot class
5.Capture a screenshot
6.Capturing a Screen Shot
7.Capturing Screen in an image using Robot class
8.Create key press event using Robot class?
9.Use Robot to do mouse press
10.Using Robot to capture a screen shapshot
11.Use Robot to send combo key event