Can anyone tell me what is the advantages of using Canvas to paint(shape eg. rectangle, oval, line) compare to using Applet(appln not using web browser).
Thank You Hydra
Joined: Jul 22, 2006
you use canvas to paint for applications. you use applet for web browser. But you have to use applet if you want people to use your game on your website or someone else's immeditaly. you must use appletview to see applets offline. but canvas will paint just like applet does but possibly faster if you use openGL on canvas.
Joined: Jun 21, 2006
Mm......Still need help
Let me rephrase my questions: My concern are drawing on an applet panel itself and drawing on Canvas.
My appln don't need to run on a web-browser, nor a game program. Is just a simple program full of shapes eg. oval, rects, lines, circles, etc., overlapping each other To draw these I can choose to draw directly on the applet panel or by extending Canvas class.
So, what I wants to know is which is the best method to use - using Applet or extends Canvas. And why too.
Joined: Mar 22, 2005
If it isn't running in a browser, then you should not use an applet. It doesn't work as you would expect outside of a browser/appletviewer environment. So the Canvas is really the only way to go.
My take on it is this - use a Canvas instead of drawing on the Applet itself. Why? Separation of concerns - have the applet simply deal with providing the "run in a webpage" capability, and how to get resources. Have the canvas deal with what canvas is good for - painting.
This way, it's easier to test each part separately, and if you ever need to "re-target" your application to run stand-alone, rather than as an applet, you've already separated the painting from the applet code - so it's much easier.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.