ScrollingUpdateApplet (Version 1.3)

ScrollingUpdateApplet is an applet that can be used to vertically scroll text over a solid color background, or over a static background image.

The text to scroll is read from a file on the host instead of from the HTML, which makes the text easy to update and to maintain. Additionally, the text file can periodically be automatically checked for updates. If an update to the text file is detected, then the vertically scrolling text displayed by the applet is dynamically updated.

ScrollingUpdateApplet also has support for a single URL. If the mouse is clicked within the applet area, then the applet will load a pre-assigned URL in an optional target.

Also available is the ScrollingUpdate class which can be used to add scrolling text to a Java applet or application. The ScrollingUpdate class is documented separately.
Operation

ScrollingUpdateApplet requires that the following class files all be located in the same directory: ScrollingUpdateApplet.class, ScrollingUpdate.class, and NetworkTextFile.class. All of these class files are included in the download package.

During initialization, ScrollingUpdateApplet will load the the GIF or JPEG image that will be used as the background image (if specified), and will then read a file on the host to retrieve the text that is to be scrolled vertically over the image.

The are a number of parameters (documented below) that control how the text will be rendered over the background. Both the font characteristics and the location of the scroll region within the background image can be specified.

The number of words that appear on a single line in the scroll region is automatically determined based upon the font characteristics and the width of the scroll region. Because each line of text is automatically formatted, the text entered in the text file does not need to be manually formatted with carriage returns. If you wish to create a line break in the text, you can enter a <BR> code or a <P> code in the text file where the line break should be placed. The <BR> code will place a line break in the text at the location of the code while the <P> code will insert a blank line in addition to inserting the line break. The <BR> or <P> code should be entered on a single line, or with at least one space on either side of the code.

The frequency at which the applet checks for changes to the text file can be specified, as well as whether or not a notification indicator should be displayed whenever an update check occurs.

The applet determines if the text file has been changed by reading the very first line of text in the file (the file header) and comparing it to the header that was read on the previous read. Note that the header is never displayed, so the header line in the file can be can be anything that you wish, such as the date and time that the file was last changed.

When you want to indicate that the text in the file has changed, simply modify the header and save the file. The next time that the applet checks the text file, it will find that the header has changed and will then reload and re-render the text to be scrolled.

Scrolling text can be paused in one of two fashions (depending upon a parameter assignment): the scrolling can be paused either by clicking anywhere within the boundaries of the applet, or by moving the mouse within the applet's boundaries. Scrolling will be resumed either when a second mouse click occurs, or when the mouse exits the applet's boundaries.

ScrollingUpdateApplet can be configured so that a mouse click within the applet's boundaries will cause a URL to be loaded. There is also a provision for specifying a target for the URL to be loaded.
Sample

No Java Support Available If your browser supports Java, you should see a demonstration of the ScrollingUpdateApplet to the left of this text.

You can view the text file that is being read to create the scrolling text.
Parameters

Following are the HTML parameters for the applet. A parameter marked "Opt" is optional, and a parameter marked "Req" is required.

Req text The name of the text file that contains the text to be vertically scrolled.

The file must reside in the same directory as the Java applet.
Opt maxSizeKB The maximum size that the text file can be in kilobytes.

If this parameter is not specified, then the parameter value defaults to "8" (i.e. 8,192 bytes, or characters).
Opt refresh The frequency in seconds that the text file should be checked for updates.

A value of zero will cause the file to be read only when the applet initializes.

If this parameter is not specified, then the parameter value defaults to "0" (i.e. do not periodically check the file for updates).
Opt notifyOnRead If this parameter is set to "true", then a small red square indicator will blink in the top left corner of the screen each time that the text file is checked for updates.

If set to "false", then no indication will be displayed that the text file has been checked.

If this parameter is not specified, then the parameter value defaults to "false".
Opt font The name of the font to use when rendering the text to be scrolled.

The font name can be any of the standard Java fonts:
  • "Dialog"
  • "Helvetica"
  • "TimesRoman"
  • "Courier"
  • "Symbol"

If this parameter is not specified, then the parameter value defaults to "TimesRoman".

Opt fontSize The size of the font used to render the text to be scrolled.

If this parameter is not specified, then the parameter value defaults to "14".
Opt fontStyle There are four valid values allowed for this parameter: "bold", "italic", "plain", or "bold+italic" (or "italic+bold").

If this parameter is not specified, then the parameter value defaults to "plain".
Opt fontColor The color of the scrolled text.

The value must be a hexadecimal RGB value. For instance "FF0000" would be red, and "888888" would be a medium gray.

If this parameter is not specified, then the text color defaults to black.
Opt justify The valid values for text justification are "left", "center", and "right".

If this parameter is not specified, then the parameter value defaults to "left".
Opt frameDelay The number of milliseconds to delay between each frame of animation (this controls how quickly the text scrolls).

If this parameter is not specified, then the parameter value defaults to "60".
Opt background The background color or the file name of a GIF or JPEG image that will be drawn behind the scrolling text.

If a color is specified, then the value must be a hexadecimal RGB value. For instance "FF0000" would result in a red background, and "888888" would result in a medium gray background.

If a file name is specified for this parameter, then any file path is based starting with the directory in which the Java applet is located.
Opt bgColor This parameter is used to set the applet's background color.

The applet background color can sometimes be seen during a screen refresh when the page that contains the applet is scrolled or resized (do not confuse the applet background color with the background image or color used for the scrolling text).

The bgColor parameter has been provided to allow you to set the applet background color so that the applet refresh is not as noticible when the page that contains the applet is scrolled or resized.

The parameter can also be used in place of the background parameter if you are using a solid color instead of an image file for the scrolling text background.

If a value for this parameter is specified, then the value must be a hexadecimal RGB value. For instance "FF0000" would result in a red applet background, and "888888" would result in a medium gray applet background (visible only during a screen refresh).

If this parameter is not specified, then the applet background color will default to white.
Opt scrollRectX The X coordinate of the top left corner of the rectangle in which the text is scrolled.

Text can be scrolled over any portion of the background. This parameter, along with scrollRectY, defines the top left corner of the area in which the text will be scrolled.

If a background color was specified instead of a background image, then scrollRectX defines the "margin" to the left and right of the scrolling text. For instance, if scrollRectX=10, scrollRectY=5, scrollRectW=50, and scrollRectH=100, then the applet width should be 70 (=10+50+10) and the applet height should be 110 (=5+100+5).

If this parameter is not specified, then the parameter value defaults to "0" (i.e., the left edge of applet area).
Opt scrollRectY The Y coordinate of the top left corner of the rectangle in which the text is scrolled.

Text can be scrolled over any portion of the background. This parameter, along with scrollRectX, defines the top left corner of the area in which the text will be scrolled.

If a background color was specified instead of a background image, then scrollRectY defines the "margin" on the top and bottom of the scrolling text. For instance, if scrollRectX=10, scrollRectY=5, scrollRectW=50, and scrollRectH=100, then the applet width should be 70 (=10+50+10) and the applet height should be 110 (=5+100+5).

If this parameter is not specified, then the parameter value defaults to "0" (i.e., the top edge of applet area).
Opt scrollRectW The width of the rectangle in which the text is scrolled.

Text can be scrolled over any portion of the background. This parameter defines the total width of the area in which the text will be scrolled.

If this parameter is not specified, then the parameter value defaults to the width of the applet.
Opt scrollRectH The height of the rectangle in which the text is scrolled.

Text can be scrolled over any portion of the background. This parameter defines the total height of the area in which the text will be scrolled.

If this parameter is not specified, then the parameter value defaults to the height of the applet.
Opt pause This parameter specifies a mouse action (or actions) that will cause the scrolling text to pause. The valid values are:
  • click - scrolling is paused when the mouse is clicked within the applet's boundaries and scrolling is resumed when the mouse is clicked a second time within the applet's boundaries

  • enter - scrolling is paused when the mouse enters the applet and scrolling is resumed when the mouse exits the applet

  • enter+click or click+enter - combination of above two options

If this parameter is not specified, then the parameter value defaults to "click"

Opt url This parameter specifies a URL to load when the mouse is clicked within the applet area.
Opt target This parameter specifies an optional target for the url parameter.
xample

An example of a HTML APPLET tag with all parameters for this applet is shown below.

<APPLET CODE="ScrollingUpdateApplet.class" WIDTH="150" HEIGHT="100">
<PARAM NAME="text" VALUE="TextToScroll.TXT">
<PARAM NAME="maxSizeKB" VALUE="1">
<PARAM NAME="refresh" VALUE="300">
<PARAM NAME="notifyOnRead" VALUE="true">
<PARAM NAME="font" VALUE="Courier">
<PARAM NAME="fontSize" VALUE="18">
<PARAM NAME="fontStyle" VALUE="bold+italic">
<PARAM NAME="fontColor" VALUE="0F342E">
<PARAM NAME="justify" VALUE="center">
<PARAM NAME="frameDelay" VALUE="60">
<PARAM NAME="background" VALUE="Graphics/BkgndImage.JPG">
<PARAM NAME="bgColor" VALUE="7D3B9D">
<PARAM NAME="scrollRectX" VALUE="25">
<PARAM NAME="scrollRectY" VALUE="25">
<PARAM NAME="scrollRectW" VALUE="100">
<PARAM NAME="scrollRectH" VALUE="50">
<PARAM NAME="pause" VALUE="enter">
<PARAM NAME="url" VALUE="http://www.modernminds.com">
<PARAM NAME="target" VALUE="_blank">
</APPLET>


Copyright

This documentation and the object code (the class files) for ScrollingUpdateApplet may be copied and distributed freely for non-commercial purposes so long as neither the code nor the documentation is altered in any way. If the object code is distributed with any documentation whatsoever, then this unaltered document must accompany the code.

Copyright © 1997 by Modern Minds, Inc.