Make your own free website on Tripod.com

HollywoodText free applet

by
Bill Giel
w3.nai.net/~rvdi/bgiel


The HollywoodText free applet displays text with the look of those computer terminal displays that exist only in the movies. But now you can have one on your homepage.


You don't have java! Why don't you get: Microsoft Explorer


The HollywoodText java applet is free for non-commercial or non-profit purposes. Please refer to the source file HollywoodText.java for further information.
Click here to download:
HollywoodText.zip
HollywoodText.java



java applet parameters

<applet code="HollywoodText.class" width="304" height="204">
<param name="cabbase" value="HollywoodText.cab">
<param name="bgcolor" value="#000000">
<param name="fgcolor" value="#00FF00">
<param name="sound" value="blip.au">
<param name="cpause" value="25">
<param name="lpause" value="250">
<param name="spause" value="500">
<param name="loop" value="0">
<param name="script" value="demo.txt">
<param name="lspace" value="15">
<param name="fontsize" value="12">
<param name="cursor" value="3">
<param name="indent" value="2">
<param name="initx" value="20">
<param name="inity" value="20">
<param name="bgimage" value="demo.gif">
<param name="maxy" value="160">
You don't have java! Why don't you get: <a href="http://www.microsoft.com/ie">Microsoft Explorer</a>
</APPLET>



To use the HollywoodText free java applet, I



java applet parameter values

You do not have to implement all of these parameters. Only a few are actually required. The first parameter, CABBASE is for MS Internet Explorer browsers and is really not a specific parameter of this java applet. It tells Explorer to download a compressed version of the applet, resulting in improved performance.

HollywoodText consists of a single class file, HollywoodText.class. For the demo, a background image, demo.gif is provided, as well as a sample text script, demo.txt. An Explorer-compatible CAB file, HollywoodText.cab is also provided which can be uploaded to your web directory for the benefit of visitors running Explorer (use the CABBASE parameter, see sample HTML below.)

The following table describes the formal parameters of the applet:

Name Type Description Default Value
HEIGHT int The height of the java applet panel in pixels, this is really not a parameter but rather an attribute of the applet tag. You should set the applet height to the vertical size of your background image (if you use one.) Required. None
WIDTH int The width of the java applet panel in pixels. Like HEIGHT, it also is an attribute of the applet tag, and should be set to the horizontal size of your background image, if you use one. Required. None
BGCOLOR String The color of the simulated screen background of the applet. Even if you provide an image (such as in the demo) the actual portion of the image where text is displayed should be an opaque color (in the demo, it is black.) If you do not use an image, this color will be used to paint the java applet panel. Colors are entered as hexadecimal RGB triplets, such as #FFFFFF or FFFFFF for white. Black
(000000)
FGCOLOR String The color used to paint the text, entered as a hexadecimal RGB triplet, such as #000000 or 000000 for black. Green
(00FF00)
SOUND String The name of an audio file (.au format) that will be played as each character is displayed. This should be a short clip, no longer then the delay setting for character pauses (by default 25 milliseconds.) The name specified should be relative to the applet's codebase. The easiest way to ensure this is to simply place your sound clip in the same directory as the java applet class file, and then just provide the filename for this parameter. None
CPAUSE int The pause interval over which the text display engine will sleep in between each character that is displayed, in milliseconds. 25 ms
LPAUSE int The pause interval over which the text display engine will sleep in between each line of text that is displayed, in milliseconds. 250 ms
SPAUSE int The pause interval over which the text display engine will sleep in between each loop of full execution (if enabled, see LOOP parameter below) in milliseconds. 500 ms
LOOP int A non-zero value causes the text display to loop continuously, subject to whatever pause value is set for SPAUSE. 1
SCRIPT String The name of the script file containing the text to be displayed, relative to the codebase of the applet. The easiest thing to do is to place your script in the same directory as your applet class, and just use its name. Required None
LSPACE int The dimension used to space lines of text. It should generally be about 25% larger then the font size. 15
FONTSIZE int The font size, in pixels, used to display text. 12
CURSOR int The width, in pixels, of the simulated cursor. 3
INDENT int The indentation, in pixels, for each line of text. This will be relative to the INITX parameter (see below.) For example, if you use an INITX value of 5, and an INDENT value of 5, text lines will start 10 pixels left of the applets left edge. 15
INITX int The x-origin of your virtual terminal area, in pixels, measured from the left edge of the applet. 0
INITY int The y-origin of your virtual terminal area, in pixels, measured downward from the top edge of the applet. 0
BGIMAGE String The optional background image. If none is provided, the applet panel will paint itself the BGCOLOR value.The image file should be relative to the applet's codebase.The easiest way to ensure this is to simply place your image in the same directory as the java applet class file, and then just provide the filename for this parameter. Both GIF's and JPG's are supported. None.
MAXY int The lowest point for text display, in pixels, measured downward from the top edge of the applet. If no MAXY value is provided, the java applet will display text to the bottom edge of the applet panel. None

Writing a Script

Writing a script for the java applet involves little more then typing each line of text that you want displayed with a text editor (such as Windows Notepad) and saving the file. You should upload your script into the same directory as your applet class file.

There are four "tags" that can be used to provide a little control over your text display.

<NEWLINE> - causes the java applet to display a blank line (skip a line.)

<NEWPAGE> - causes the java applet to display on a fresh "page", clearing old text, although this is also handled automatically. Use <NEWPAGE> to force it if desired.

<PAUSE ###> - causes the java applet to pause display for a specified number of milliseconds. For example, <PAUSE 1000> will result in a 1 second delay. A value of 0 will suspend the applet, but clicking on it will restart it.

<MORE> - will display "More..." and suspend the java applet, click to restart. This will also be handled automatically, but you can force display of "More..." with this tag.

Sample Script - Here's the script used in the demo:

HollywoodText Demo
------------------
This java applet displays text the way
Hollywood movie computers do.
<NEWLINE>
<PAUSE 1000>
When you see "More..." click on
the java applet to continue.
That's all... it's trivial,
but a fun applet for a personal
web page :-)
<NEWLINE>
<PAUSE 1000>
Click on the java applet to run it
again.

Note that the code does not automatically wrap long lines. Compose your script so that it takes the width of your text display into consideration.



[ CLICK HERE for free applets ]
www.Free-Applets.com
Last updated: