I'm not exactly sure how your logic works, but regardless, I can offer
this advice.  If you need a the mouse path plotted, you can't reply on
the number of events as the mouse passes across.  You notice this in
paint programs where you wiggle the mouse really quickly and you can
see it stamping the brush at the message locations.  To plot the
correct path you need to "draw lines" between the event location and
the last event (assume the mouse has passed through that line).  I'm
not sure exactly how Swing events work (I assume you are using Swing),
but if you are doing too much work in the event handler, perhaps it's
not going to give you any more events until you return from the
handler.  I'm just guessing here, this might not be the case.  But if
it is, you might need to put the coordinates on some kind of queue
that's processes on another thread.  The problem there is that the
queue could get backed up and out of sync.

On Jun 29, 9:29 pm, Shooter <[email protected]> wrote:
> I created a panel that draws rectangles as the user drags the mouse
> over an image.  The rectangles are of fixed height(the height of the
> image) and cannot overlap.  The logic works fine, and I can stop the
> dragging when the mouse event is contained inside of an already
> existing rectangle.
>
> My problem is when the mouse is moved very fast, the mouse event is
> not processed quick enough, and the rectangles end up stopping well
> before running into another rectangle.  This means that the size of
> the rectangle is not being recomputed at the same speed as the check
> for containment is happening (yet they are in the same block of code)
>
> Overall, what are the best ways to improve performance when doing
> mouse moved and mouse dragged on complex GUIs?

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to