File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes  How do i refresh theSystem Time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

How do i refresh theSystem Time

Nikhilesh Gandhi
Greenhorn

Joined: Feb 07, 2004
Posts: 8
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

Joined: Jul 27, 2001
Posts: 1365
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

Joined: Oct 18, 2000
Posts: 4121

Closing this thread... already asked here.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i refresh theSystem Time