This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overriding update()

 
Sam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
Why do we explicitly override update() method when repaint() automatically gives call to update() ? I think, the purpose is that no flickering is there when the output is shown to the appletviewer / browser.
However, when we call repaint() and doesn't explicitly override update() in our program, then what repaint() does, it first clears the screen, i.e., whatever previously drawn on the applet gets cleared and then it calls update() which then calls the paint() method.
But when we explicitly override update() in our program, then what repaint() does is that without clearing what is previously drawn on the applet , it calls update() which in turn calls repaint(). Thus, previously drawn things doesn't get cleared.
If I don't override update(), flickering is there. And if do , previously drawn things doesn't get cleared.
Anyone has the way out ?
Thanx in advance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic