Make a mutable image, as you do in case of screen capture and then allow the user to play with pointer over it. Create mutable image using:
Image mutableImage=Image.createImage(getWidth(), getHeight()); Graphics g=mutableImage.getGraphics(); mutableImage.paint(g);
Now to get the color of the selected pixel x,y:
You can get a unique pixel from an image using the getRGB() method. Here is an example:
int[] aux=new int[1]; image1.getRGB(aux,0,image1.getWidth(),x,y,1,1);
At this moment, you have in aux the ARGB code of the (x,y) pixel contained in the image image1. aux is an array, and then have only one component with the pixel in format 0xAARRGGBB (A=opacity, R=red level, G=green level, B=blue level (levels from 0 to 255)). If you need the red, green and blue levels, you can use it:
int[] p=new int[3]; p[0]=(int)((aux[0]&0x00FF0000)>>>16); //Red level p[1]=(int)((aux[0]&0x0000FF00)>>>8); //Green level p[2]=(int)(aux[0]&0x000000FF); //Blue level
And if you need the opacity level, you can do it:
int a=(int)((aux[0]&0xFF000000)>>>24); //Opacity level