File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic

How do i refresh theSystem Time

Nikhilesh Gandhi

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);
public static void main(String[] args)
Timer myTimer = new Timer();
ttask myTask = new ttask();
InternalFrameDemo frame = new InternalFrameDemo();
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

Joined: Oct 18, 2000
Posts: 4121

Closing this thread... already asked here.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: How do i refresh theSystem Time
It's not a secret anymore!