ImageIcon mouse clicks?
I have an array of 11 x 11 "Pieces" that hold an ImageIcon of a hexagon. I drew the hexagons onto a JPanel using the paintIcon(this, g, row, col) method.
Now I am trying to see which Piece is clicked using a MouseListener, but when I added the MouseListener to the Panel, it would be unable to see any of the Icons. When I added the MouseListener to the Icon, it wouldn't respond when I clicked anything.
Advice on how to make Icons recognize mouse clicks from within a JPanel?
I can't put the Icon onto a JButton because the hexagons interlock like this: http://www.rekenwonder.com/images/hex.gif
Quick responses would be appreciated, thanks!