How to get the color of a pixel on the screen in JAVA 2D game?

2

Is there any way to get the color of a pixel at the x and y coordinates of the screen that I specify?

    
asked by anonymous 15.06.2014 / 00:05

1 answer

0

A little vague your question, but try using:

       package teste2;

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

       public class teste {

      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());
      }



            }
    
25.06.2014 / 20:44