Thank you for visiting Blazing Games

Getting applet properties

If you remember last chapter, applications can have parameters passed to them by adding them to the command line. The main method receives the methods in the args variable that is passed to the main method. Applications do not use the main method. Instead, any parameters that are passed to an application must come from the web page that is presenting the applet.

The html file that contains the applet can contain a number of parameters. They use the format:
<PARAM NAME="name" VALUE="value">
The name of the parameter is case sensitive and up to the author of the applet. The value is sent to the applet as a string. Converting the string to the format you require is up to the programmer. As the applet needs integers, a special method was written to take the string parameters and convert them into integers. The reason for a special method for doing this task is due to the need for trapping potential conversion problems.This method is fairly generic so it could be used anywhere.

To get the parameters, the applet class has a method called getParameter. Within the init method, I use this to initialize the two class variables columnStart and rowStart.

Previous Chapter 4 Contents Page 6 of 10 Book Contents Next

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2003-2006 Blazing Games Inc. All Rights Reserved