• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Accumulating Drawn Objects

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
This question confuses me ...
The way to accumulate drawn objects on the screen is to:
a) Call update() from within repaint()
b) Call update() from within paint()
c) Call accumulate() from within paint()
d) Call paint() from within update()
What is meant by "accumulate"? I'm guessing it's just a synonym for paint (to avoid being too obvious), in which case I'd guess "d" because update() _does_ call paint() (which in turn paints objects to the screen). Sound reasonable?
Thanks!
Greg
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could equally well be a) as you would normally call repaint() from within own applet methods and that in turn calls update() .
repaint =====> update() =====> paint()
Very strange wording
------------------
Regards,
Dave
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The default version of update() paints with the default Background color and then calls paint()...in which case the previous contents get erased. In order to avoid this override update() to call paint directly without painting with the BAckground color as in...
public void update(Graphics g)
{
paint(g);
}
 
Do not threaten THIS beaver! Not even with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic