
November 14th, 2012, 08:26 AM
|
 |
Java Junkie
|
|
Join Date: Jan 2004
Location: Mobile, Alabama
|
|
Quote: | Originally Posted by lisa92 I have a object moving according to a certain algorithm and I want to make it move a different way every 5 seconds. How do i do that using the timer? |
You would attach an ActionListener to the timer that fires once every 5 seconds. Each time actionPerformed is called you would modify a variable that makes your object move differently.
|