Getting all mouse locations
I've been searching around the topic including this forum but haven't come across anything helpful.
I'm basically trying to build the "brush" tool in my "paint" program, which I would like to act much like the one in MS Paint or any other paint program you can find.
Apart from some other issues I'm trying to figure out, currently the major one is about painting on the canvas/image while the mouse is being "dragged".
If I use mouse listeners to capture pressed/dragged/released events, the dragged method gets called by the EDT(event dispatching thread) with too large periods for a brush tool - since it fires MouseEvent e for a dragged point, it does not contain all the points that the mouse pointer has moved since the dragging started from the source point. Thus I get gaps between each brush stroke, the faster the mouse is dragged, the larger the gap. I wrote a trigonometric function that divides the line between source/target drag points to the needed number of points with each dx/dy increments in the direction from source to target, but this doesn't feel very convenient.
I have also tried capturing Component.getMouseLocation() from a separate thread and invoking paints on the EDT using SwingUtilities.invokeAndWait(), and even created a second non-EDT thread later, one for capturing mouse location, the other for calling EDT to do painting, but still, gaps are too wide and the code is just getting more and more complicated & messy.
I'm seriously hoping that I'm missing a simple something and this is really child's play. I appreciate all the ideas.