File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

paint

 
fraternity lawson
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An AWT GUI under exposure condition,which one or more method will b
e invok when it redraw?
A.paint(); B.update(); C.repaint(); D.drawing();
I think repaint will call update which in turn will call paint().Do let me know if am wrong.
 
Ash sav
Ranch Hand
Posts: 55
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think update() and repaint()
 
Tracy Qi
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
update (): which clears the component to its back ground color and then calls paint().
repaint (): this method schedules a call to the update() method. This entire mean is that a request flag is set in the GUI thread. Every 100 milliseconds the GUI thread checks the flag. No matter how many requests are made during any 100 milliseconds only a single call is made to update ().
The call to the repaint () method ends immediately. The call to the repaint () method only schedules a repainting of the component. AWT thread should eventually call the update () method to perform the actual repainting of the component.
The repaint() method is overloaded. The no-args version of repaint() does not cause your user interface to repaint right away. In fact, when repaint() returns, your component has not yet been repainted - you��ve only issued a request for a repaint(). There is another version of repaint() that requests the component to be repainted within a certain number of milliseconds.
If not overridden the update method clears the background and calls paint(); By overriding the update method, any previously drawn graphics will not be cleared. This is only a trivial way of preserving any graphics drawn. If the application is resized or the drawing area covered in some way the graphics will be cleared.

Hope this helps.
Tracy

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic