Darryl Burke wrote:A JLabel (or indeed any Component) can respond to mouse events by adding a MouseListener (or as applicable, a MouseMotionListener). A GridLayout(3, 3) can take care of positioning andsizing of components.
More here: Creating a GUI With Swing.
thanks a lot. It solved the problem. I added the mouse listener to my JPanel class but as I click the underlying frame the event is again invoked.
I have got a JPanelClickEventListener as follows:
and I added an instance of the event Listener class to my JPanels as follows:
I should mention that the preceding code resides in a class extending JFrame.