• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timer Animation Multiple Classes  RSS feed

 
annod ener
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am brand new to java...so bear with me, please.

I have an assignment to write a program that races three cars across a JFrame using a Timer and Timer Listener and ActionEvent. It works perfectly! The cars race back and forth across the jframe ...as long as all of the code to actually move (translate) the cars is in the main/inner TimerListener class. If I relocate the movement code to a moveCars() method in another class, and then call moveCars() from its original location in the main/TimerListener the cars are stationary. I have repainted everywhere, but the cars do not move. The assignment specifies exactly what class the methods should be in. If someone can help, I can post the code.

hotrod
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1103
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi annod,
Welcome to the Ranch!

Yes, you should create a small program that re-creates the problem and post the code. This is called SSCCE.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!