Neomorph <ne******@nospam.demon.co.uk> wrote in
news:sj********************************@4ax.com:
On 21 Aug 2003 00:28:41 -0700, an*****@indiatimes.com (Anks) two-finger
typed:
Hi
Thanks for your response but i still didn't got it completely.
You have asked to use date object but i did not find any such method
in date classes which ensures a sleep of specified time(1000ms).How
can I use date objects in place of sleep.
Thanks
Anks
He meant that you use Thread.sleep() with a lower number in combination
with checking the date/time of the system to see if you need to update the
visual representation.
I would use System.currentTimeMillis() for faster more accurate
comparisons between the previous update and the next.
e.g. if you first update was done on 123456789 milliseconds, and after
System.sleep(250), it shows 123457500 (711 ms later), you can sleep another
289 ms before updating again.
Actually I would just be lazy and update the display with the current time
(acquired from a new Date object) every time that the applet thread becomes
runnable again. creating and displaying a text clock a few times each second
certainly isn't going to bog down the machine...at least it shouldn't. :^)
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---