DJScroller

Applet Features Applet support for both Images and Text. Attach a URL to any line. All configuration is done with a simple ASCII text file. Insert a complete Paragraph with one command and the applet will automatically line wrap the text. Use your own background images, Display an optional scroll bar, and more ....

Typical Applet Definition

<APPLET CODE="DJScroller.class" Archive = DJFiles.zip WIDTH=300 HEIGHT=200>

The following lines determine the scroll speed, colors , and size of the border in pixels around the scroller .

The frame variable allows use to launch any URL's to a frame other than the Applets frame.

If the background image parameter "bg" is supplied in the Applet definition, It will override the backgroundColor Attribute. The applet will attempt to tile the image supplied by the "bg" parameter into the background of the applet.

The scrollbar parameter allows us to place a scrollbar on the right side of the applet that the user can manipulate. The scrollbar is the size of the border, so a border size other than 0 must be defined. If you don't want the border to be displayed, set the "borderColor" parameter the same as the "backgroundColor" parameter.

<Param name = scrollSpeed value = 20>
<Param name = foregroundColor value =0xFFFFFF>
<Param name = backgroundColor value =0x000000>
<Param name = borderColor value = 0x888888>
<Param name = borderSize value = 5>
<Param name = frame value = "_top">
<Param name = bg value = wood1.jpg>
<Param name = scrollbar value = false>
<Param name = scrollbarColor value = 0xFFFFFF>
<Param name = engine value = Qengine.txt>

The script file that is displayed is read from the "engine" parameter filename listed above. In this case the file name is Qengine.txt. It can be any valid file name.

Parameter Definitions

foregroundColor | The forground color of the applet. Default text color.
backgroundColor | The background color of the applet. This is the background od the scrolling area
borderColor | If a border size other than 0 is used, this is the color of the border
scrollSpeed | The scroll speed of the applet in milliseconds
borderSize | The size of the border. 0 = no border.
frame | Frame to launch any URL links. The default is "_top"
bg | An alternate background image. If defined it will override the backgroundColor parameter. The applet will tile the image supplied into the background of the scroll area.
scrollBar | value is TRUE or FALSE . The scroll bar will be the same size as the border area so a border size must be defined for the scrollbar to be displayed.
scrollBarColor | The color of the scrollbar. Default is lightgray
appletFontSize | The default text font size. 12 if omitted
engine | This is the ascii file that defines the scrips. See below for definitions

How data in the script file is parsed

All data Line values have two parameter lists seperated the "|" symbol. The first parameter list defines the attributes of the line or image. The second parameter defines the Image to display or the line of text to display. Attributes are separated with a comma. Spaces are allowed. Text entered can be any length. The Program will determine where to break the paragraph into individual lines based on the font size.

Example of a single line of text:

Text, bold , fontSize = 20 , center, color = 0xFF0000, delayAtTop = 100 | this is a sample line

The line is defined as a Text line
Display in 20 point font
center the line in the applet
set the color of the line RED
"this is a sample line" is the text to be displayed
when the text line reaches the top of the applet, it will pause for 100 times the "scrollSpeed" parameter, or in this example 2 seconds.

Example of displaying an image

Image, continue| my_image.gif

The line to display is an image
The name of the Image is 'my_image.gif'
The continue attribute says " place the next statement on the same line" . Use this command for font and color changes on the same line. Also use it for bullets as shown in the sample Applet.

DJScroller Action Commands

The following are all the commands that are valid . Some commands can not be used together or will be ignored. For example " Image,font=10" makes no sense.

Text | This is designation for a text line
Image | This is the designation for an Image
Right | Position the object on the far right side of the Applet
Center | Center the object in the middle of the Applet
Color | color=<hex color> color =0xFFFFFF is an example of setting the color of the line to White
FontSize | font=<font_size> font = 20 will set the line font to 20
URL | url=http://some_server.com This command will attach a link to the text and underline it
FontType | The Font type to use. Dialog, SansSerif, Serif, Monospaced, or DialogInput are valid font types.
Bold | bold will set the line to a bold font
Italic | italic will set the line to an Italic font
Plain | This is the default if Italic or Bold are not selected
Offset | Use this command to offset the image or text from the left side of Applet. ( i.e. Offset = 20 pixels)
delayAtTop | This command will force the line of text or image to delay at the top of the screen, and then move on. Value is a multiple of scrollSpeed
Continue | This command will place the object but no create a new line. Use this command to place bullets or other images next to Text
Line | This command will force a blank line. use it for formatting
Para | Paragraph read. Para allows you to read an entire ASCII file and put it in the Applet . This is a powerful command. As an example, the script "Para | USNews.txt " would force the applet to read in the entire ascii file called USNews.txt and insert it into the applet as a single formated line.

There are a few restrictions to formatting and some general guidelines

- Line wrapping doesn't support centered text. If you center text, it must fit within the applets width parameter on one line only
- BOLD and ITALIC are not supported on the same line
- A very large Applet size will make the Mouse "grab and scroll" function sluggish.
- The scroll operation is CPU intensive and the maximum scrolling speed will be determined by the size of the applet, the total vertical size of the scroll area, and the CPU speed of the users computer.
- The entire vertical scrolling area is preprocessed before the applet begins to scroll. This means that the use of images has no effect other than they increase the total vertical size of the scroll area if they are quite large.

This is the script file for the applet example running at the top of this page

Studing this code should give you a good fundamental idea of how to create your own script file.

Text,bold,color=0xFF55FF,center,fontsize=18,delayAtTop = 50|DJScroller
line
image,center|bear.gif
Text,center,bold,color=0xFF00FF|© 2000 DecafJava
line
Text, center, url =http://www.decafjava.com,color = 0xFF0000|DecafJava.com
line
line
line
Para,fontSize = 10, color = 0xFFFFFF, delayAtTop = 150|intro.txt
line
Text,fontsize=20,color=0x00FF00,continue|"Print in "
Text,italic,fontsize=20,color=0x0000FF|" Italics"
Text,bold,fontsize=20,color=0x0000FF,fonttype= Monospaced,center|Print in BOLD
Text,fontsize=18,color=0x00FF00,fonttype=DialogInput,right|Print Plain
line
line,delayattop=200 |Applet Features
image,continue|blueball.gif
Text, fontsize=10, offset=10|Add bullets
image,continue|blueball.gif
Text,fontsize=10,offset=10 |Screeen Stop and Drag
image,continue|blueball.gif
Text,fontsize=10,offset=10 |Add Background Image
image,continue|blueball.gif
Text,fontsize=10,offset=10 |Insert a Paragraph of data
image,continue|blueball.gif
Text,fontsize=10,offset=10 |Optional Scroll Bar
image,continue|blueball.gif
Text,fontsize=10,offset=10 |URL Support
image,continue|blueball.gif
Text,fontsize=10,offset=10 |Simple Configuration
Text,center,color=0xFFFFFF|'________________________'

Running the Applet without a Script file

If for some reason you would rather not use a scriptfile, you can enter command data with the <PARAM> command. Each line of code is entered by using the "data" name in the Param line as follows. This format can work well if you only are scrolling a few lines of code and they will not change very often. Changing and formating can become painful since to add a line in the middle of the scroller, all lines below it must be renamed.

<APPLET CODE="DJScroller.class" Archive = DJFiles.zip WIDTH=300 HEIGHT=200>
<Param name = scrollSpeed value = 20>
<Param name = foregroundColor value =0xFFFFFF>
<Param name = backgroundColor value =0x000000>
<Param name = borderColor value = 0x888888>
<Param name = borderSize value = 5>
<Param name = frame value = "_top">
<Param name = bg value = wood1.jpg>
<Param name = scrollbar value = false>
<Param name = scrollbarColor value = 0xFFFFFF>
<Param name = data0 value = "text, fontSize = 20, delayAtTop = 100|This is a test line">
<Param name = data1 value = "text, fontSize = 20|This is a second test line">
</APPLET>

© 2000, Kenneth Rigoni. All rights reserved.

All evaluation applets are fully functional copies of our commercial versions. A reference to our Web Site appears on the status bar.
DECAF JAVA