This site requires JavaScript, please enable it in your browser!
Greenfoot back
davemib123
davemib123 wrote ...

2014/7/29

repaint();

davemib123 davemib123

2014/7/29

#
How does repaint() work?
lordhershey lordhershey

2014/7/29

#
I only know from an Applet perspective, but it puts a request to the system to repaint the Applet Canvas when possible, you can make it happen faster by issuing repaint(0); which means do it right now. If use awt you will get flicker and you might have to resort to overriding the update routine and possibly making a double buffer, there is a double buffer available since the Grpahics2D package so you will not have to create that yourself.
davmac davmac

2014/7/29

#
davemib123 wrote...
How does repaint() work?
If you mean the World's repaint() method, it just forces the world to be repainted. You should only need to use it if you have a long loop in your code which changes the world. Normally repaints only occur between act cycles (or when you use Greenfoot.delay()). If that doesn't answer your question you'll need to be more specific.
davemib123 davemib123

2014/7/30

#
yea, thanks for that. Just wanted to know what it actually does :)
You need to login to post a reply.