I am writing a game in java and it has a grid view where you can left click on a single box (the box becomes red). How can make it so that after left clicking on a box if I keep pressing the left click and move the cursor onto another box it will keep clicking. Any suggestions ? I hope I was clear. Thanks.
Share
You need to add a
MouseMotionListenerto your component.The
mouseDraggedmethod will be called when the user moves the mouse whilst holding a mouse button down. You can then check if the cursor is over another box and fill it red.