• Post Reply Bookmark Topic Watch Topic
  • New Topic

repaint not calling paintComponent after thread suspension  RSS feed

 
Ammar Karimi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm having a problem with repaint. I'm writing a program to control a man walking around the screen carrying out instructions, for which I'm using a thread called midRunner. Up till now, my program had been working fine, but then I decided to add a button to allow the man to be paused and restarted. The pause button sets the thread to null, and the start button does midRunner = new Thread(this)(the thread had been initialised at the beginning of the program too, btw). The pause button worked, but when I click on start, eventhough I go through the exact same code, this time around repaint does not invoke paintComponent. I added statement lines which showed that run() is called, the new co-ordinates are being calculated as before and repaint is also being called, but the statements in paintComponent are no longer showing up (obviously meaning that it's not being called).
I have tried to only include as much of the code as I thought would help solve the problem. Hope someone can help, this is my final year project
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!