This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Animation Problem  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am writing a simple animation application.It is supposed to countinuosly shows a word on the screen and every 30 ms change the location of the word according to a formula.
I thought that it had to worked automatically using Thread but after showing the word on the screen for the first time , it do not change the position of the word.Actually I was expected to have from Main() -> Start() -> Run() (updating position and also the screen using repant())if I add ex.start() at the end of the main() everything works but the background do not update.
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ November 28, 2004: Message edited by: Dirk Schreckmann ]
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to put ex.start() in main, because even though it created it, it will not start the thread without that being called. Likewise, to stop it, you will eventually need to call ex.stop().

I am not sure what you mean exactly by the background does not update, but I am guessing you mean the old words do not disappear. This is because you are overriding paint(), and if I remember correctly, repaint() calls paint, which at this time is only writing the string to the screen. Perhaps you should put what is in paint() at this time in a method by another name...call that new method, and then repaint();

LoDown
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!