Chapter 3: Using Java on Your Pages

index | previous

Figure 3.11
Fig. 3.11  The text comes up from the bottom...
 
 
Figure 3.12
Fig. 3.12  ...and scrolls off at the top.
 
 

To pass parameters to an applet:

1.  
<PARAM NAME="LINE1"
--> VALUE="In today's
--> top story:">
<PARAM NAME="LINE2"
--> VALUE=" Java:Visual
--> QuickStart Guide">

A PARAM tag consists of two attributes, NAME and VALUE, both of which are required. For each NAME, there must be an associated VALUE. For this use of the tinyScroller applet, we'll set LINE1 through LINE9 to get the results that we see scrolled in Figures 3.11 and 3.12.

2.
<PARAM NAME="BGRED"
--> VALUE="255">
<PARAM NAME="BGGREEN"
--> VALUE="255">
<PARAM NAME="BGBLUE"
--> VALUE="255">
<PARAM NAME="FGRED"
--> VALUE="0">
<PARAM NAME="FGGREEN"
--> VALUE="0">
<PARAM NAME="FGBLUE"
--> VALUE="0">

Here we set the background color to white (red, green, and blue all set to 255) and the foreground color to black (red, green, and blue all set to 0). These are the defaults, so the Web page display would be the same even if these values were missing.

3.
<PARAM NAME="DELAY"
--> VALUE="5">
<PARAM NAME="MAXLINE"
--> VALUE="9">

The default value of DELAY is 100 milliseconds, but that seems somewhat slow, so we reset it here to 5 milliseconds. If there are less than 12 lines to scroll, MAXLINE needs tobe set to the correct number, which in this case is 9.

red checkmarkTip

In the above example, the parametersfor BACKGROUND, XPOS, and SPACING were not set, as the defaults were acceptable. The background and foreground colors could also have been left off, as they're just using the defaults.