Java: Scrolling Text

Java applets are actually files external to your web page. You run the applet from your page, and configure the parameters for the application in the HTML code of your page, but the actual bits that do the work are external to your web page.

In this case, there's a file called ScrollingText.class that is the Java applet. It's in the review directory (it's best to keep the applet in the same directory as the web page). We're going to insert this applet at the bottom of the Milton Review page.

Open up the Milton Review page in Notepad, and go to the bottom of the HTML code. We're going to replace the University of Richmond banner with this applet.

Next, take a look at scrolling.txt, which contains the parameters we need to paste into the Milton Review page to make the applet work. Copy these parameters to your clipboard and paste them into the Milton Review HTML page where the link to the University home page appears.

Once you've pasted the code, take a look at what's there. First, there are two images that will be on either side of the applet. These work well to frame the scrolling text on the page. Immediately next to the image (since we don't want a space between the image and the applet) is the code that tells the browser where to find the java applet. It's also here that you specify the width of the applet.

Next you'll see a number of parameters. Here's what they do:

  1. String: between the quotes put whatever text you want scrolled in the applet.
  2. Style: I'm not sure, but I believe you can specify plain, bold or italic here
  3. Font: specify the font you want to use. Remember the user must have the font on their PC
  4. Size: specify the font size to use. This is in points (in this case, it's 40 point text).
  5. Color: specify the font color using hex values. I've picked red.
  6. Speed: this controls how quickly the text will scroll. I've played with the speed (higher numbers mean faster), and you may want to as well
  7. Background: specify the background color using hex values. I've picked a dark blue.
  8. HREF: specify where to send the user should they click on the scrolling text
  9. Target: specify whether a new browser window opens or not (in this case, not) when the user is taken to the specified site

Save the HTML page and reload the Milton Review page in your browser. The applet should be scrolling at the bottom.

Unfortunately something in IE 4.0 doesn't like this applet. If you have a significant number of visitors using IE 4.0, the applet won't show and the two images will be one above the other with blank space in between. Not pretty. You may want to check with developer.com to see if they've got a different applet that works in both browsers.


H O M E B A C K