Yep. I use a MouseListener in my code, or you can read through the tutorial: How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
Type: Posts; User: KevinWorkman
Yep. I use a MouseListener in my code, or you can read through the tutorial: How to Write a Mouse Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
Let's see, I have an example of extending JPanel and overriding paintComponent to paint a grid, then using a MouseListener to detect mouse events around here somewhere...
Ah, here it is: (Kevin's)...
I would probably extend JPanel and override paintComponent() to draw the board, then use a MouseListener to detect mouse movement, dragging, and releases. There are other ways to go about this, but...