Re: call a method at intervals
- From: Andy <andy@xxxxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 16:14:50 +0100
rickbear wrote:
Hi!
I made an applet in one class.
Now I would like to call two of the methods in a certain timeinterval.
Something like javascript's setInterval("method()", milliseconds);
The one method has to run every minute and the other on every fifth
minute.
Is that possible without making more classes? and how?
- rick -
THere are various ways to do this:
One is using the swing Timer Class. Another way is to create a new thread and point it to a class that implements the Runnable interface.
There are howtos on both of these techniques on the sun website tutorials section.
http://java.sun.com/docs/books/tutorial/essential/threads/
http://java.sun.com/products/jfc/tsc/articles/timer/
Andy
.
- References:
- call a method at intervals
- From: rickbear
- call a method at intervals
- Prev by Date: How do you connect to an Access-based database with JDBC?
- Next by Date: call a method at intervals
- Previous by thread: call a method at intervals
- Next by thread: JTable cell editing deselects row, workaround?
- Index(es):