I'm trying to take a screenshot and then look through it for a pixel that has a certain color. Firstly, I tried to just print the color of an image at a certain xy coordinate but I could not even do that. What am I doing wrong?
static int ScreenWidth;
static int ScreenHeight;
static Robot robot;
/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    // TODO code application logic 
    callibrateScreenSize();
    findSquares();
    //takeScreenShot();
    try {
        Thread.sleep(1000);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
public static void callibrateScreenSize() {
    try {
        Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
        ScreenWidth = captureSize.width;
        ScreenHeight = captureSize.height;
        System.out.println("Width is " + ScreenWidth);
        System.out.println("Height is " + ScreenHeight);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //return null;
}
public static BufferedImage takeScreenShot() {
    Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
    BufferedImage image = robot.createScreenCapture(captureSize);
    return image;
}
public static void findSquares() {
    System.out.println(takeScreenShot().getRGB(5,5));
}
Thanks!
 
     
     
    