I want to produced a sound when I clicked on one of my buffereImage. But it display me this error: The method addMouseListener(new MouseAdapter(){}) is undefined for the type BufferedImage
here are the code:
public class TestPane extends JPanel {
public TestPane() {
setLayout(new PropertionalLayoutManager(400, 400));
add(new Symbol(), new PropertionalConstraint(0f, 0));
add(new Symbol(), new PropertionalConstraint(0.67f, 0));
//add(new Symbol(), new PropertionalConstraint(0f, 0.4675f));
//add(new Symbol(), new PropertionalConstraint(0.67f, 0.4675f));
add(new Drum(), new PropertionalConstraint(0.205f, 0.1f));
add(new Drum(), new PropertionalConstraint(0.5f, 0.1f));
add(new Drum(), new PropertionalConstraint(0f, 0.33f));
add(new Drum(), new PropertionalConstraint(0.705f, 0.33f));
DRUM.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent me)
{
Sound1.Sound5.play();
}
});
}static {
try {
SYMBOL = ImageIO.read(new File("HiCrash.png"));
} catch (IOException ex) {
ex.printStackTrace();
}
try {
DRUM = ImageIO.read(new File("HiTom.png"));
} catch (IOException ex) {
ex.printStackTrace();
}
}
}