Results 1 to 5 of 5
  1. #1
    kookevk is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default I need a DELAY Timer.

    I created a Memory game, where you pick two cards that match.

    My problem: After the player chooses the second card, both cards flip back (my cards are buttons so, button.setEnabled(true);)

    What I want: A delay so that the player can see both cards for x seconds and then they flip back. I already know how to flip them back and forth. Just need a 'delay timer'

    Thanks

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,453
    Blog Entries
    7
    Rep Power
    20

    Default Re: I need a DELAY Timer.

    Look at the Timer classes; the java.utils.Timer class can do exactly what you want.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    kookevk is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default Re: I need a DELAY Timer.

    I can't figure out how to use the Timer class. I've created a Timer object, I've tried using the start() method, setRepeat method, nothing works.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,453
    Blog Entries
    7
    Rep Power
    20

    Default Re: I need a DELAY Timer.

    Quote Originally Posted by kookevk View Post
    I can't figure out how to use the Timer class. I've created a Timer object, I've tried using the start() method, setRepeat method, nothing works.
    Have you read the API documentation for those classes?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: I need a DELAY Timer.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How can I change a timer's delay?
    By chrishans in forum New To Java
    Replies: 7
    Last Post: 11-08-2011, 05:07 PM
  2. Stopping a Timer from Inside the timer
    By krishnan in forum Java Applets
    Replies: 2
    Last Post: 10-04-2010, 11:15 PM
  3. can i set a timer delay on mouseEntered event
    By chan in forum AWT / Swing
    Replies: 1
    Last Post: 08-30-2009, 05:55 AM
  4. Replies: 0
    Last Post: 04-04-2008, 02:46 PM
  5. Replies: 0
    Last Post: 02-05-2008, 10:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •