Description
The GetAppletParameter class was created
to make it much easier to read parameters that are
passed from HTML documents to Java applets.
Using the GetAppletParameter class, you
can easily pass the following data types from HTML files to
your Java applets:
- Color's
- String's
- int's
- long's
- float's
- double's
- boolean's
- char's
What your Java code will look like
The GetAppletParameter greatly simplifies the process of
passing data into applets. When retrieving applet parameters,
your Java code will look as simple as this:
Color c = GetAppletParameter.toColor(this, "COLOR", Color.red);
int i = GetAppletParameter.toInt(this, "INT", -1);
long l = GetAppletParameter.toLong(this, "LONG", -1);
float f = GetAppletParameter.toFloat(this, "FLOAT", defFloat);
double d = GetAppletParameter.toDouble(this, "DOUBLE", -1.0);
String s = GetAppletParameter.toString(this, "STRING", "oops");
boolean b = GetAppletParameter.toBoolean(this, "BOOLEAN", true);
char ch = GetAppletParameter.toChar(this, "CHAR", 'Z');
The GAPDriver demo
The GAPDriver applet
is a driver program that we use to test
the GetAppletParameter class. Click
here to run the GAPDriver applet.
After you've viewed the applet, click
here to view the GAPDriver HTML code. Within this HTML
code, you'll see how the parameters are passed to the
applet.
The GetAppletParameter source code
If you'd like to use the GetAppletParameter class to simplify
your work with Java applets, just click on the links
shown below. Be warned though -
once you start using this class, passing data into applets
will be easier than ever before!
Download all the source
From these links you can download any of the source files
you're interested in:
|