I have my code up to here:
package RGBValues;
import java.awt.Color;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PointerInfo;
import java.awt.Robot;
public class RGBValues {
public static void main(String[] args) throws Exception {
PointerInfo pointer;
pointer = MouseInfo.getPointerInfo();
Point coord = pointer.getLocation();
Robot robot = new Robot();
robot.delay(2000);
while(true) {
coord = MouseInfo.getPointerInfo().getLocation()…
Color color = robot.getPixelColor((int)coord.getX(), (int)coord.getY());
if( color.getGreen() == 255 &&
color.getBlue() == 255 &&
color.getRed() == 255
) {
System.out.println("WHITE");
}
robot.delay(1000);
}
}
}
I'm stuck on how to make it so that wherever the mouse is pointing on the screen, it will show me the RGB values for that pixel underneath the pointer. Can someone help and on what to do? I am very new to java so I don't know how to fix this.