Problem with MouseListener and JComponent
807603Feb 15 2008 — edited Feb 17 2008Hi, I am making a "game" where I have a 2D map made of png images and I want to enable the user to click on each separate image that makes together a whole map. I figured out how to do that in the JPanel when I tried out if the coordinates of the mouseevent overlay any of the used images, but I would like to handle the mouseevent for each of the image separately. 
I created the class Region extends JComponent implements MouseListener. This class draws the ImageIcon. I used setBounds to set the JComponent to the ImageIcon location and size and I didn't forget to add the mouseListener, but I still can get no response from any mouse clicking efforts. I guess there is still something I must do in order to get the JComponent and MouseListener working, but I dunno what. Thanks for advice.