• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread.sleep() not working correctly

 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I want to make a game. For it i need that the arithmatic symbols should be shown on buttons for 3 seconds and then replaced by "??". However it's only working 1 time . The code above serves intended purpose for 1 round and then it only shows ?? and not the new set of symbols(for 3 secs.)..
If you'll comment the mark method and delay it's working fine. else it only works for 1 time.
Please someone help. I've been trying to make it work since 3 days.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you read Concurrency in Swing. I think javax.swing.Timer is going to be your friend here. Don't hesitate to restart() it when necessary.
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:I suggest you read Concurrency in Swing. I think javax.swing.Timer is going to be your friend here. Don't hesitate to restart() it when necessary.


thanks for the reply. I still don't get it. How should i use it ?? o.O
i don't want automatic action events .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!