Sending Parameters to Applets

Java applets are never run from the command line, so you can't specify arguments the way you can with applications. Applets use a different way to receive information at the time the program is run. This configuration information is called parameters, and you can send parameters through the HTML page that runs the applet. You have to use a special HTML tag for parameters called param.

To see how the Blanks application would be rewritten as an applet, open your word processor, enter the text of Listing 4.5, then save the file as

Listing 4.5. The Full Text of
 1: import java.awt.*; 2: 3: public class BlanksApplet extends javax.swing.JApplet { 4: String parameter1; 5: String parameter2; ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.