chivas12 0 Newbie Poster

i wanted my program to show up in a Jframe the code reads the pixel color i want the frame to display red= pixel color blue= pixel color and green= pixel color and how would you make the background color of the frame change according the mouse movement for example if it was on white to change to white or if it was on black to chnage to black.
here what i have so far

 import java.awt.AWTException;
 import java.awt.MouseInfo;
 import java.awt.Point;
 import java.awt.PointerInfo;
 import java.awt.Robot;

  public class PixelColor {
    public static void main(String[] args) throws AWTException {
    PointerInfo pointer;
    pointer = MouseInfo.getPointerInfo();
    Point coord = pointer.getLocation();

    Robot robot = new Robot();
    robot.delay(2000);


    while(true) 
    {
        pointer = MouseInfo.getPointerInfo();
        coord = pointer.getLocation();

        System.out.println(" color: " + robot.getPixelColor(coord.x, coord.y).getRed() +                                             
                               ", " + robot.getPixelColor(coord.x, coord.y).getGreen() + 
                    ", " + robot.getPixelColor(coord.x, coord.y).getBlue());
    }










  }
}