Timer?

Hi, I'm trying to program this matchcard(memory) game for my school project. I need to know how I can set a timer for my program so that when a user clicks a card to flip over, then clicks a second card there is a delay so that both cards pictures are clearly shown, say for... 5 seconds so that the user can see that they are wrong (assuming that they didnt match). Can anyone help me? Please try to keep it as simple as possible so that I won't have to use something my teacher referred to as threading or things of that nature. Can someone help? Thank you

[567 byte] By [kRnpandaa] at [2007-10-2 20:39:26]
# 1
http://java.sun.com/products/jfc/tsc/articles/timer/Give it a go and feel free to come back with concrete questions when and if you get stuck. Good luck.
Lokoa at 2007-7-13 23:22:36 > top of Java-index,Other Topics,Algorithms...
# 2

thanks for the link. I spoke to my teacher some more and it seems what I'm looking for is a function that will allow me to pause the progam to cause a delay during an actionlistener (i.e. when a user clicks an incorrect second card in my match card program). Is there a method that does this rather than an actionlistener? or can this actionlistener be linked so that it delays when it reaches a specific else statement within another action listener?

kRnpandaa at 2007-7-13 23:22:36 > top of Java-index,Other Topics,Algorithms...
# 3

One very simple way to pause a program is to use:try {

Thread.sleep(n);

} catch (InterruptedException ex) {

// Ignore

}

where n is the number of milliseconds - e.g. 5000 for 5 seconds.

TimRyanNZa at 2007-7-13 23:22:36 > top of Java-index,Other Topics,Algorithms...