Reputation: 471
I am making a game that does something 10 times every second in java. I want to make something that schedules this for me What would be a good resource to look at? EDIT: Must be original java source.... no external software.
Upvotes: 0
Views: 477
Reputation: 8101
Creating a TimerTask
and scheduling it to run after a particular interval should do the trick..
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
//your task
}
};
schedule it using
new Timer().scheduleAtFixedRate(timerTask, 0, 60*100);
Upvotes: 4
Reputation: 11310
Just look at java quartz. it can help you do whatever you want
http://www.mkyong.com/java/quartz-scheduler-example/
Upvotes: 0