So part of my program requires me to get the RGB value of wherever the mouse is above IN THE JFRAME. It's not working though, and I'm not entirely sure if the x,y coordinates im using for getPixelColor is giving me the color of those coordinates within the screen instead of the jframe. What would be the best way to get the color of where the mouse is within the Jframe?
public void mouseMoved(MouseEvent e) {
// check the color of the pixel the the mouse is over, and
// go to the next level, or show the game over screen
Robot robot = null;
try {
robot = new Robot();
} catch (AWTException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
int xcord = e.getX();
int ycord = e.getY();
Color color = robot.getPixelColor(xcord, ycord);
System.out.println(color);
}