hi, i have searched online and can't seem to find something I understand for a timer. I have a boggle game that needs to have a 3 minute counter so I figured I'd have a countdown from 3 minutes...but the only thing I've found in other peoples codes and the api is the Timer class but I think I don't understand it because it wants a task and all I really want is the timer and I would have a method in there that checks it and when its zero, the game is over. Or maybe the task could be to send a message to another method in a different class that tells the game to end....but I just need someone to explain the Timer class in dummy terms for me...please

which Timer

1/ java.util.Timer
2/ java.swing.Timer

remove dupilacates post

From what you describe a javax.swing.Timer would seem the best fit. Start a timer with a 3 minute countdown. When the Timer expires it calls a method of yours that handles "game over". It's as easy as that. Just try it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.