Elapsed time - how to update every second?

Hi,

I'm working on an internet cafe program to keep track of all the times (when a customer starts, and when a customer stops, etc).

I'm just starting to learn Java at the moment so my progress is a bit slow at the moment! However, I'm slowly getting a grasp on things.

Here's my question:

Start time: 17:24:01 (24 hour format)

Stop time: <-how can I get this to advance like a stopwatch to see the elapsed time from the start time to the current time (ie. how long the customer has been using a computer)?

So far, I'm able to start the time, stop the time, calculate the elapsed time, and store the values in an array, but I'm not sure how to display the elapsed time in "live" format.

If anyone could point me in the right direction it would be great! I've been searching for ages on the net but I can't seem to find the info I need.

I'm not a student looking for a solution to my homework! I'm just trying to get my newbie feet wet in Java :-)

Thanks!

[1028 byte] By [paulinnorwaya] at [2007-11-27 5:09:04]
# 1
What's your UI? Swing?
Hippolytea at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...
# 2
threads are your answer, search them on google, its pretty straightforward
boblettoj99a at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...
# 3
Try printing a bunch of backspace characters: "\b", or the "\r" carriage return. http://weblogs.java.net/blog/crazybob/archive/2004/08/jazz_up_your_cl.html(won't work for Swing, only console)
kevjavaa at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...
# 4
Yeah, UI is Swing
paulinnorwaya at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...
# 5
Then "Swing timer" are your Google keywords.
DrClapa at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...
# 6
Read the Swing tutorial section on swing timers: http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.htmlIt's just what you need.
Hippolytea at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...
# 7
DrClap and Hippolyte,I'll have a look at that now.Thanks for the help :-)
paulinnorwaya at 2007-7-12 10:28:39 > top of Java-index,Java Essentials,Java Programming...