Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pausing the Mouse Listener

 
James Filson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21319
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2612
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic