A MouseListener would allow you to listen for any sort of mouse click and act accordingly.

How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event...