Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display time

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am able to get the current system time on a JLabel but I want to see the time changing on it please any body help me
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd probably start a thread that sleeps for whatever interval you want to update the label. Upon waking up it would set the text on the label with the current time before once again going to sleep.
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.swing.Timer would be a perfect candidate. Its events are executed on the Event Dispatcher Thread so no need to work with invokeLater.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic