Owl Sams Teach Yourself Java 2 in 24 Hours

Hour 13: Learning How Applets Work

NOTES AND CORRECTIONS

  • Sun renamed the Swing package of classes after the book went to press. If you're using JDK 1.2 Beta 4, the name is com.sun.java.swing as shown in the book. If you're using any other version of JDK 1.2 or Java 2 SDK v. 1.2, the name should be javax.swing. Sun has announced that javax.swing is the official name for the package, so no more changes should be necessary. All of the source code on this site has been updated to refer to javax.swing.

SOURCE FILES

READER QUESTIONS

  • Question: The BigDebtApplet program compiles and can be run within appletviewer, but it won't run in either the current Netscape Navigator or Microsoft Internet Explorer. Why is this the case when other applets will run?
    Answer:  BigDebtApplet won't run outside of appletviewer because it's one of several applets in the book that requires a Java 2-capable browser. Neither Navigator nor Internet Explorer supports 2 fully at this time, so Sun has developed a Java Plug-in that enhances their built-in Java support.
    The Plug-in is a Java interpreter that can be used as an alternative to the Java interpreters included with Navigator and Internet Explorer. A Java programmer uses a modified <APPLET> tag to make the Java Plug-in run the applet if the plug-in is present on a user's system (if not, the plug-in can be immediately installed).
    Sun has created an HTML Converter that will read an .html file containing applets and convert the HTML so that the applets use the Java Plug-in.
    None of the book's .html files have been modified to call the Java Plug-in, so they're being added to this Web site as time permits. The first example is BigDebtApplet_plugin.html.

     

ACTIVITIES