Learn Java: Java Applets: AnimatedAd applet
Developer's Daily Java Applets
  front page | java | perl | unix | DevDirectory
   
Front Page
Java
Applets
   
The "AnimatedAd" applet

Description

The AnimatedAd applet is based on the original TV ads created by Sun Microsystems to promote Java (TM) and the concept of network computing. Although we can't remember exactly what the ads looked like, they featured a series of rapidly-displayed words followed by a static phrase for a few moments. After a brief pause, the words began flashing on-screen all over again.

In our approach, the text string, font size, font color, and font style are all varied with a random number generator. Other characteristics, such as delay times between string displays, are also variable. In this way, our "ad banner" can be quite different than an animated GIF.


Features

The AnimatedAd applet lets you control the following parameters through HTML "param" tags:

  • The background color
  • Text strings to display
  • An array of possible font colors
  • An array of possible font styles
  • An array of possible font sizes
  • The time to pause between displays of the strings
  • The time to pause after the main string
  • The number of times the flashing words should appear
  • Min and max coordinates for the text strings
  • The X-Y coordinates for the final string
  • The URL to go to when the applet is clicked

See it in action

Click here to see the AnimatedAd in action

Click here to see the new AnimatedAd2 applet.


Java source code and Class files

The source code for the applet consists of two files that you should download:

If you'd rather just download the Java classes, you can download them from these links:

Please note that a new version of the GetAppletParameter class is about to be released. The new version will cover additional data types, such as boolean and byte types. Please check back here, or at our main Java page for the latest version.


HTML Source Code

You can also click here to view/save a sample HTML page that invokes the AnimatedAd applet. This page provides a listing of the many parameters that can be modified to make the AnimatedAd look and work the way you want it to. (Remember to save the file with a .html filename extension.)


Copyright 1998 DevDaily Interactive, Inc.
All Rights Reserved.