Download the JDK
Search the Tutorials
Hide the TOC
Trail: Deployment
Lesson: Applets
Section: Taking Advantage of the Applet API
Subsection: Defining and Using Applet Parameters
Applets
Getting Started with Applets
Importing Classes and Packages for Applets
Defining an Applet Subclass
The Life Cycle of an Applet
Methods for Milestones
Methods for Drawing and Event Handling
Methods for Adding UI Components
What Applets Can and Can't Do
Taking Advantage of the Applet API
Finding and Loading Data Files
Displaying Short Status Strings
Displaying Documents in the Browser
Sending Messages to Other Applets
Playing Sounds
Defining and Using Applet Parameters
Deciding Which Parameters to Support
Writing the Code to Support Parameters
Giving Information about Parameters
Using the APPLET Tag
Practical Considerations When Writing Applets
Security Restrictions
Creating a User Interface
Creating a GUI
Displaying Diagnostics to the Standard Output and Error Streams
Getting System Properties
Threads in Applets
Threads in Applets: Examples
Working with a Server-Side Application
A Simple Network Client Applet
Using a Server to Work Around Security Restrictions
Finishing an Applet
Before You Ship that Applet
The Perfectly Finished Applet
Deploying Applets
General Deployment Considerations
Using the applet Tag
Using the object Tag
Using the embed Tag
Deploying Applets in a Mixed-Browser Environment
Solving Common Applet Problems
Questions and Exercises
Home Page > Deployment > Applets
Giving Information about Parameters

> Now that you've provided all those nice parameters to the user, you need to help the user set the parameter values correctly. Of course, your applet's documentation should describe each parameter and give the user examples and hints of setting them. Your job doesn't stop there, though. You should also implement the `getParameterInfo` method so that it returns information about your applet's parameters. Browsers can use this information to help the user set your applet's parameter values.

> Below is an example of implementing the `getParameterInfo` method.

> >     public String[][] getParameterInfo() {
> >         String[][] info = {
> >           // Parameter Name     Kind of Value   Description
> >             {"imagesource",     "URL",          "a directory"},
> >             {"startup",         "URL",          "displayed at startup"},
> >             {"background",      "URL",          "displayed as background"},
> >             {"startimage",      "int",          "start index"},
> >             {"endimage",        "int",          "end index"},
> >             {"namepattern",     "URL",          "used to generate indexed names"},
> >             {"pause",           "int",          "milliseconds"},
> >             {"pauses",          "ints",         "milliseconds"},
> >             {"repeat",          "boolean",      "repeat or not"},
> >             {"positions",       "coordinates",  "path"},
> >             {"soundsource",     "URL",          "audio directory"},
> >             {"soundtrack",      "URL",          "background music"},
> >             {"sounds",          "URLs",         "audio samples"},
> >         };
> >         return info;
> >     }

> As you can see, the `getParameterInfo` method must return an array of three-`String` arrays. In each three-`String` array, the first string is the parameter name. The second string gives the user a hint about what general kind of value the applet needs for the parameter. The third string describes the meaning of the parameter.

Previous page: Writing the Code to Support Parameters
Next page: Using the APPLET Tag