3QuarksAppletsFigurinesParameter
Example This small example shows an applet with only two figurines.

The background color and the background image of the applet, the number and the characteristics of the figurines as well as the deceleration time up to the starting of the demonstration mode are controlled via four parameters.

The Figurines applet is written in "pure Java 1.0" and runs problem-free on all Java able Browsers.
  <applet code=Figurines.class width=180 height=180>
    <param name=BackgroundColor value="192,165,138">
    <param name=BackgroundImage value="Paper.jpg,9,9,9,9">
    <param name=Figurine01 value="Figurine03.gif,34,24,7,75">
    <param name=Figurine02 value="Figurine04.gif,104,24,7,75">
    <param name=DemoDelay value="30">
  </applet>

ParameterBackgroundColor
  <param name=BackgroundColor value="192,165,138">
  <param name=BackgroundColor value="#c0a58a">


With the parameter "BackgroundColor" you can configure the background color of the applet. The color is specified either by using a comma separated string with values for red, green and blue or alternatively using the hexadecimal HTML format "#rrggbb." When the button is initially displayed, the background is filled as fast as possible with this color. Even if the applet uses a background image, a background color should be always specified. Otherwise the applet default background color (light-grey) appears first.
ParameterBackgroundColor
  <param name=BackgroundImage value="Picture.jpg">
  <param name=BackgroundImage value="Paper.jpg,9,9,9,9">


The optional background picture of the applet is set by the parameter "BackgroundImage." The value specifies the file name of the background picture. The currently supported image formats are GIF and JPG.

With the first version the background picture is drawn directly in the applet. If the applet is larger than the picture, then the applet is tiled using the picture. In such cases so-called seamless tiles should be used. If the applet is smaller, then the background picture is truncated on the right and bottom sides.

The second version is used for seamless background tiles with a boundary region. The first numeric value determines the lefthand side, second the top margin, third the right edge and finally the fourth value the lower edge. The boundary region will be cut out of the sample and the edges of the applet are filled with this edge sample. The remaining inner sample is then tiled in the applet. This version is used during the above example applet. The left figure shows the original sample, the right figure the individual low-cut areas of the sample.
Paper Paper.jpg
72 × 72 pixel image size
9 pixel margin on all sides
54 × 54 pixel inner size
BackgroundImage
ParameterFigurine
  <param name=Figurine01 value="Figurine03.gif,34,24,7,75">
  <param name=Figurine02 value="Figurine04.gif,104,24,7,75">


With this parameter the figurine resources are specified. The parameter is numbered consecutively to two places and begins at "01." So between one and ninety-nine figurines can be used.

The first value determines graphic resources in the GIF or JPG format. In this picture all animation phases are summarised. If you want to use a background sample in the applet, then the figurines should be present as transparent GIF, whereby the transparent color should correspond to the averaged color of the background sample. In this example the transparent color is equal to the background color. The following two values determine the position of the figure related to the left upper corner of the applet. The next value indicates, how many animation phases are available in the picture. In this example there are seven phases. The last value finally indicates the delay time in units of thousandths of seconds between the individual animation phases. The animation begins with the first phase, runs up to the last and afterwards again backwards to the first phase.
Figurine03.gif
294 × 130 pixel
Figurine04.gif
294 × 130 pixel
ParameterDemoDelay
  <param name=DemoDelay value="30">

By specification of the parameter "DemoDelay" the demonstration mode is activated. This mode is started automatically, if the background sample and the figurines are loaded and the user does not become active within a certain time interval. Then the applet randomly starts some figurines, lets them turn for a while and stops them again. As soon as the user starts or stops a figurine, the demonstration is terminated. The specified value determines the waiting period in seconds.
21, May 2000