• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using repaint() inside actionPerformed(Event e ){}

 
Alexandre Baldo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys!
I'm trying to move a circle from one side of the screen to another...
It works if I put the code inside my main class.
But, if I have a button on the screen and push it, when the actionPerformed method get called it doesn't refresh the screen.
Why does it works outside the actionPerformed and doesn't inside??

Thank's!!



 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does it works outside the actionPerformed and doesn't inside??
The event dispatch thread does one thing at a time.
Try starting the animation on another thread.
 
Alexandre Baldo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank's Craig!!
It worked just fine!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!