This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Timer Animation Multiple Classes

 
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!