this is my code i have a few problems but this is the biggie:
< { Robot robot = new Robot(); Color color0 = new Color(39, 36, 11); Rectangle a = new Rectangle(0, 0, 1365, 770); Rectangle b = b; { BufferedImage image = robot.createScreenCapture(a); search: for(int x = 0; x < a.getWidth(); x++) { for(int y = 0; y < a.getHeight(); y++) { if(image.getRGB(x, y) == color0.getRGB()) { b = new Rectangle(x, y, 435, 430); break search; } } } } >
i am getting error:
java:99: variable b might not have been initialized
Rectangle b = b;
^
what i want this snippet of code to do is take a shot of the screen with Rectangle a, search the shot for a pixel, use that pixels x, y point along with the supplied width and height to set a new rectangle, Rectangle b which i use later in my code. how do i fix this error and still give the code the functionality i describe above?
thanks guys