This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Pausing the Mouse Listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Pausing the Mouse Listener" Watch "Pausing the Mouse Listener" New topic
Author

Pausing the Mouse Listener

James Filson
Greenhorn

Joined: Nov 24, 2009
Posts: 11
Hi,

I want to disallow the user's click from being registered until my animation on a JPanel has completed. I've tried setting a boolean to true once the animation is completed, and checking the boolean before registering the mouse click. However, it seems that Swing just 'queues' the mouse click until the animation has finished processing so this doesn't work, as by that time the boolean has already been set.

Does anybody have any tips on how I can do this? Thanks in advance
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19351
    
  10

James Filson wrote:I've tried setting a boolean to true once the animation is completed, and checking the boolean before registering the mouse click.


Perhaps you aren't actually doing that.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2261
    
    8
However, it seems that Swing just 'queues' the mouse click until the animation has finished processing


No, because as you where told in your last posting, animation should NOT be done on the EDT.

Does anybody have any tips on how I can do this?


As Paul said above you are probably not doing what you think you are doing. We are NOT mind readers and since you haven't posted a SSCCE like you've been asked to do in the past you are on your own. I'm not going to sit here wasting time asking for a SSCCE every time you post a question.
 
 
subject: Pausing the Mouse Listener