Skyline's for all


Source Code

Getting initial data into the program

I pass building coordinates to the applet via applet parameters.
<param name=bldgIn value="
    1,11,5,
    2,6,7,
    3,13,9,
    12,7,16,
    14,3,25,
    19,18,22,
    23,13,29,
    24,4,28
">
Use get Parameter to read in a specific parameter:
String foo = getParameter("bar");
I have combined the getParameter with the creation of a new 'StringTokenizer' object.
StringTokenizer bldgSt = new StringTokenizer(getParameter("bldgIn"),",");

A StringTokenizer is a lot like the perl split function. Split, in perl, splits the contents of a variable based on a regular expression supplied as the field delimiter. For example, assume
$st= "1,11,5,2,6,7,3,13,9";
@list = split(/,/,$st);
Then the array, @list, will contain the numbers split on the regular expression /,/.
In the same way, in java getParameter puts the contents of the parameter listed in the HTML file into the specified variable, and then StringTokenizer reads that String, and splits it on the specified delimiter.

Perl's split is more flexible on how data is split, while Java's StringTokenizer provides more powerful methods to access the resulting split data.

The end result, is that I get a class instance of StringTokenizer, called 'bldgSt' which contains the numbers that I want.

You may note that using individual numbers, split by commas, leaves me open to all kinds of problems...like forgetting one number in a building triplet, and so messing up the alignment on all of the rest...that is absolutely true, but on the plus side, this method is a _lot_ cooler than hard coding the building addresses within the applet!

The problem of battling JDK's

The Java Development Kit is moving too fast, even in Internet time, for the browsers to keep up. The short result of this is that you must use _only_ JDK version 1.0 features if you want your applets to run under Netscape Navigator 3.x.
Some features of JDK 1.1 were available in Netscape Communicator (aka Navigator 4.0), but not all.
If you are developing only for yourself, then it doesn't matter, and by all means go out and get the latest patches to Communicator and develop to 1.1.6.

Personally, unless I must have 1.1 features (read JDBC), I want any Java enabled browser to be capable of running my applets, which means kludgy work arounds and the painful continuous use of 'deprecated' features ('deprecated' is Javaspeak for 'this will probably work on most systems, so we don't want you to use it.').