Enhance Your Web Site with a Java Slideshow Applet

Enhance Your Web Site with a Java Slideshow Applet

Not only programmers can enjoy the benefits of Java. Java applets (small Java programs), which can enhance your Web site immensely, are available on the Internet–many for free. Of course, many of them are really just gimmicky. How many times have you waited for a large applet to download on a site only to find it provides yet another rippling text effect?

In this column, I describe an applet that actually is useful, and which you can easily customize to suit your needs with hardly any programming skill at all!

The Slideshow Applet
Many Java programmers make applets available on their Web sites. Before discontinuing his Web site at the end of 2001, Java applet writer David Griffiths did also. He wrote the slideshow applet that I discuss in this article, which he named “gallery”.

Griffiths’s gallery applet repeatedly displays a series of images, which can be any combination of GIFs and JPGs. The applet also can be turned into a hyperlink, so viewers can click to a specific URL. A variety of effects are built in to enhance the transition between one image and the next. (Click here to see some examples of these image transitions.)

Why Is This Useful?
This applet can serve a range of purposes. For one, you obviously can show your own picture gallery (holiday snapshots, perhaps) in an entertaining way that doesn’t require your visitors to scroll through pages and repeatedly click on miniscule thumbnails.

Another use might be to add a dynamic touch to a professional’s online resume–a couple of pictures in high-powered poses, fading from one to the next, could leave a strong impression.

Online shopping sites can use the applet to display a series of rotating advertisements in an eye-catching fashion by saving the advertisements as GIF or JPG images. The advertisements could be special offers, which provide the viewer with more information–and the opportunity to buy–when he or she clicks on them.

These are only a couple of the ways this applet can be applied. You may come up with uses more suitable to your particular site and find other ways to dazzle your visitors with the gallery app.What You Need to Do
To use this applet yourself, download the source code file. Next, publish the gallery.jar file into your Web site’s directory on your Web server. Then, in the HTML pages for your site, insert a tag wherever you want to use the applet.

The following code makes a Web page that displays the pictures from my example in the previous section:

                      Put something here for browsers that don't understand Java

The tag indicates that the applet requires some parameters, and each one requires a value. This is the only programming you have to do. The available parameters are as follows:

  • image
    This parameter specifies the list of images used in the slide show. The parameters should be passed as image0, image1, image2, and so on. You can use as many images as you want.
  • mixers
    These are the transition effects that the slideshow will use, given as a comma-separated list. The choices are “ImageMixer” (simple cross-fade), “Burn” (irregular fade, colored to resemble fire), “Butterfly” (expanding X fade), “Smoke” (irregular smoke-like fade), and “Wipe” (horizontal or vertical wipe).

    So, for instance, if you want to use only “Smoke” and “ImageMixer”, the mixers parameter should be set to “Smoke, ImageMixer”. Be careful with the capitalization of the mixer names–if you get the cases of the letters wrong, they will not work. If you don’t specify any mixers, then the applet uses them all.

  • href
    If you want to use the applet as a hyperlink, set the href parameter to the URL for the page that you want users to go to when they click the applet.
  • target
    This parameter is needed only if you use frames. If you use the applet as a link, then enter the name of the target frame into which the page will be loaded.
  • map
    Gallery can use image maps from the page that contains it. For example, if you have a tag in a page called “fred”, then you should set the map parameter to “fred” (not “#fred”).
  • I suggest you put the gallery.jar file in the same directory as the page on which it will appear. If you want to move it elsewhere, use the “CODEBASE” option to point to the appropriate directory. Because the applet is stored in the gallery.jar archive file, you will need to add “archive=gallery.jar” into your applet statement, as in the code snippet above.


    About Our Editorial Process

    At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

    See our full editorial policy.

    About Our Journalist

    ©2024 Copyright DevX - All Rights Reserved. Registration or use of this site constitutes acceptance of our Terms of Service and Privacy Policy.