This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
This is for a simple point and click game. Because of the nature of the game I would prefer to use the swing UI rather than using basic graphics (it would take too long to explain why). At the moment Im using labels with gif icons and transparent backgrounds. Is there any way to find the color displayed at the point where the mouse clicked? I realise that the color model holds data for each pixel but i dont know how the coordinates map to the pixel number and the RGB at each pixel just seems to be counting upwards in any case. Also, Id be grateful if someone could explain how the gif transparancies work and what RGB value is registered for a transparent background.
This example works in older j2se versions. If you are using j2se 1.4+ you can load your image(s) with ImageIO.read which returns a BufferedImage. In the BufferedImage api you can then use the method getRGB to get your color information.