Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

How do i refresh theSystem Time

 
Nikhilesh Gandhi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi !
I want to display a digital clock in my application but i acn only get the current system time .
I does not refresh.
here is the code i am using it is a part of a longer prg but here is only what is relevant
public static class ttask extends TimerTask
{
public void run()
{
int time = calendar.get(Calendar.SECOND);
System.out.println(time);
}
}
public static void main(String[] args)
{
Timer myTimer = new Timer();
ttask myTask = new ttask();
myTimer.schedule(myTask,1000,500);
InternalFrameDemo frame = new InternalFrameDemo();
try
{
Thread.sleep(5000);
}
catch(InterruptedException exc)
{}

}
}
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Report post to moderator
Seems like you can start a thread to track time but don't have the GUI code. Moving this to the Swing/GUI forum.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing this thread... already asked here.
 
    Bookmark Topic Watch Topic
  • New Topic