I have the following image
(source: depositphotos.com)
I'd like to use it to implement a music juke box.
How can I find out the pixel of subimage and set it as a button?
I have the following image
(source: depositphotos.com)
I'd like to use it to implement a music juke box.
How can I find out the pixel of subimage and set it as a button?
You can grab the Raster of Pixels within a BufferedImage:
BufferedImage buffImg = ImageIO.read(new FileInputStream(new File(<pathToFile>)));
Raster rast = buffImg.getRaster();
However, that will not get you too far I thing. Instead, try taking a JPanel, put the image as its background, and then place the Button on top of the area of the image where you want the button do be. Then, set Opaque to false with:
<your button object>.setOpaque(false);