I have read 3 different introductory books covering different areas of Java. I also have perused many Java books at the book store. Can you explain the pros and cons of using applets vs. applications for a beginner. I have written small examples of each and know just the basics. I am still new to Java and do not clearly see when to use one versus the other. Observations: A. I see books where the author concentrates on applets and does not even address applications. B. I see books that concentrate on applications and may have on a few applet examples. C. It seems any book I have looked at where the author is describing 2D graphics. Drawing a circle, etc., I have only seen Applet examples.
Applets are basically expecting to run in a browser. The browser will have to download the applet software and then run in the JVM (Java Virtual Machine). If your applet is huge, then it will need to download and it may take a long time to do so. This is one disavantage. Another disadvantage is that not all JVMs are created equal. JVMs exist in the browser on the clients machine. So if you have an applet, and you can't predict your clients browser, you may again have issues. Applications are a bit more strict. You can run that right off the desktop. They do need to be installed (like any other software package). Since they do not run in the browser you may control the environment a bit more. Those are a few of the differences. Hope that helps. Dale
------------------ By failing to prepare, you are preparing to fail. Benjamin Franklin (1706 - 1790)
By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Well I think this is a deep dark secret, but I will tell you my opinion. Once an author has a mini-application or applet set up to test the code that they are writing about, it is easier to just use it over and over . And the Graphics2D thing: applets come with a method createImage() which allows you to draw on it. Nice and clean. If you want to do the same thing in an application instead, then you need to use Toolkit.getDefaultToolkit().createImage() which looks a whole lot more complicated, and muddies the issue with Toolkit topics. I think that they do it to avoid confusion.
"JavaRanch, where the deer and the Certified play" - David O'Meara