• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

paint

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think update() and repaint()
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
reply
    Bookmark Topic Watch Topic
  • New Topic