This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.