my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes Display running time in JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Display running time in JLabel" Watch "Display running time in JLabel" New topic

Display running time in JLabel

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
I need to display the running time (Only need HH:MM) in a JLabel for one of our apps. The time I need to display is the time from our database. I am getting the time from our DB with a stored procedure. I could just go out to the DB every minute and get the time, but that seems very inefficient, doesn't it?

Is there any other way to accomplish this?

Thanks for any help!
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Allow me to suggest the javax.swing.Timer class.

Good Luck,
It is sorta covered in the JavaRanch Style Guide.
subject: Display running time in JLabel
Similar Threads
How to read instance variable dynamically?
On the fly html
refresh a JPanel automatically as time changes
howto prevent JLabel text selection
web application works fine with us and canada time