This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

update and repaint

 
Rich Wright
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a little confused about update() and repaint(). If you need to refresh part of the screen that was hidden by another window would you call the repaint() method (The repaint() method would schedule a call to the update() method).
Thanks for your help
 
Pawel Veselov
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct.
The difference between update() and repaint() is that update has Graphics instance as an argument, so it does know where to draw on.
repaint() is a empty scheduler, that doesn't make a repaint. This allow you to call repaint() and continue execution. The update() will be called in another thread (AWT-Motif, if I am not mistaken)
To repaint piece of a component, you can use repaint(int, int, int, int). In that case, update() will received clipped Graphics.

------------------
With best of best regards, Pawel S. Veselov ( aka Black Angel )
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic