Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

pausing JButton

 
Derek Williams
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making a simple memory game and it works except for 1 issue. The game makes 24 buttons and associates a picture when clicked. My issue is when the player clicks the 2nd card during a turn it does the checking so fast you never see the 2nd card unless it is a match. I tried putting in a thread sleep, (try {Thread.sleep(1000);} catch (InterruptedException ex){})

It seems no matter where i put it in the if statement it does always pauses the same way. Is there a way to make this pause more targeted or to use another method?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put your 'checkMatch' code into a Timer (setRepeats(false))
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!