So my latest project is an adaption of Conway's Game of Life, which I've successfully knocked together in an hour or two.
For drawing the "pixels" on the grid I use a MouseAdapter which the custom panel listens to.
Wouldn't life be great if this just worked?
But what I'm finding is that if I'm selecting squares and the mouse moves even the tiniest amount, which happens quite a lot if I'm trying to draw a line quickly, for example, the click doesn't register. I suppose this is because Swing now considers this a "drag" event.
Now what would be quite good would be if I could actually draw a line by dragging the mouse from one square to another. So I try:
and don't expect this to work properly, because multiple mouseDragged events would toggle the square repeatedly. However when I tried it, dragging the mouse doesn't seem to do anything at all. I debugged and mouseDragged is never entered... even when I most definitely drag my mouse over the panel... not sure why?
Anyway, can anyone think of a good solution to this, i.e. getting the application to interpret mini-drags as clicks?
EDIT to say: good heavens! This is on the front page of Google search for "swing mousedragged" already!