L E D   T i c k e r



Your browser does not support Java applets - sorry!


~ the perfect addition to any homepage ~

How to put the ticker on your page

Download all the Java class files below and put them in the directory with the page that uses them. Use a normal <applet> tag to specify the size and options of the applet. Lots of aspects of the ticker can be completely controlled using <param> tags - see below. You do not need the source code to run the applet. Don't change the names of the downloaded class files.

Ticker.class
Ticker.java
This is the main applet container for the ticker.
Chars.class
Chars.java
This class implements the static String arrays used to create the character set.
LEDRenderer.class
LEDRenderer.java
This class implements the renderer used to draw the ticker. A synchronized page-flipping methodology is used so the applet can be repainted both on schedule, and when requested by the OS.

HTML used for applet above.

<applet code="Ticker.class" width=600 height=60> <param name="interval" value="50"> <param name="squareleds" value="false"> <param name="dotdiameter" value="4"> <param name="dotoffset" value="5"> <param name="dotgroup" value="2"> <param name="oncolor" value="#000000"> <param name="offcolor" value="#999999"> <param name="bgcolor" value="#ffffff"> <param name="string" value="LED TICKER V1.0"> Your browser does not support Java applets - sorry! </applet>

Parameters

All parameters except "string" can be left out and will be defaulted.

Parameter Name

Description

interval

millisecond animation interval
How long to sleep between animation frames. The smaller this number, the faster the ticker runs.

squareleds

boolean: true or false
If "true", the LED's are drawn square, not round. This speeds up rendering and also looks quite cool.

Your browser does not support Java applets - sorry!

dotdiameter

number of pixels
The diameter of the LEDs (or the edge dimension for sqaure LEDs). Warning: must be 3 or bigger for round LEDs. Anything less than 3 and the whole thing just disappears.
dotoffset number of pixels
Distance between centers of LEDs. Add one to 'dotdiameter' to get a one-pixel gap between LEDs. Or try further apart for funky "Times Square" effects.

Your browser does not support Java applets - sorry!
dotgroup number
The number of LEDs used in a group. The applet immediately above has dotgroup=1, which gives a nice 'pager' type message; while the one at the top of the page has dotgroup=2, which gives you a bigger display with more impact.
oncolor, offcolor, bgcolor #00ff00 - HTML hex colour specifier.
Colour specifiers for the applet background colour, as well as the LED 'on' and 'off' colours.
string Text string
The string to be displayed. Make sure you check out the 'Character Set' section below.


Ticker Character Set

The applet knows the following characters:

ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 !\/'#$()_-?@:£

If it isn't displaying (you get a gray box), check you haven't used an unknown character. The applet will tell you about any unknown characters in the Java Console (if you have it enabled).


Technical

The ticker applet operates a threaded, page-flipping background renderer for smooth operation.

When started, the applet re-computes the 'string' parameter to a six-element array of strings (the characters are 6 pixels high). Each character in 'string' is converted to its Char equivalent. The applet then creates a Renderer and starts its thread running.

The thread creates a backing image (so we don't have to draw on the primary surface) and draws the first frame. When the frame is ready, the renderer calls the applet back and tells it to paint. The renderer then goes to sleep for 'interval' milliseconds (30 seems to work well here).

During this sleeping interval, the applet container (Ticker) has retrieved the backing image and blitted it onto the primary surface. If the user uncovers their browser, the applet will also retrieve and re-blit the backing image. However, the renderer and the retrieval method are both synchronized, so one must always wait while the other is accessing the backing image.


Contacting me!

I would appreciate a mail if you used the ticker for anything: john.hawksley@gmail.com


License

The applet is distributed under the terms of the GNU General Public License, a copy of which can be had here. Don't worry - this means you can do pretty much anything with it.