Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2004

Tip: Looking for answers? Try searching our database.

A timed event.

Thread view: 
Simon Teff - 12 Apr 2004 17:09 GMT
I have created some code that manipulated some figures but I would like the
code to run evey 10 seconds.
I know this is easy for some but I am new to Java.
Please help.

Simon.
Christophe Vanfleteren - 12 Apr 2004 17:47 GMT
> I have created some code that manipulated some figures but I would like
> the code to run evey 10 seconds.
> I know this is easy for some but I am new to Java.
> Please help.
>
> Simon.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Timer.html

If you need to do this in a Gui, you might want to look at
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/Timer.html

Signature

Kind regards,
Christophe Vanfleteren

Simon Teff - 12 Apr 2004 18:26 GMT
Thanks for the reply. Do you have an example of real coding.

Simon.

> > I have created some code that manipulated some figures but I would like
> > the code to run evey 10 seconds.
[quoted text clipped - 7 lines]
> If you need to do this in a Gui, you might want to look at
> http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/Timer.html
Roedy Green - 12 Apr 2004 19:53 GMT
>I have created some code that manipulated some figures but I would like the
>code to run evey 10 seconds.

If you want a task to be run at some time in the future or repeatedly
at regular intervals, you can schedule it with the java.util.Timer
class. See also javax.swing.Timer.

They are pretty straightforward once you understand Threads.

see http://mindprod.com/jgloss/thread.html
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.