Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Enhance Your Web Site with a Java Slideshow Applet : Page 2

Learn to use a Web site-enhancing applet that you can easily customize to suit your needs with hardly any programming skill at all.


advertisement
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 <APPLET ...> 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:

<applet code="Gallery" archive="gallery.jar" width="300" height="400" name=gallery1> <param name="image0" value="DMW-01.gif"> <param name="image1" value="DMW-02.gif"> <param name="image2" value="DMW-03.gif"> <param name="image3" value="DMW-04.gif"> <param name="mixers" value="ImageMixer, Burn, Butterfly, Smoke, Wipe"> Put something here for browsers that don't understand Java </applet>



The <PARAM ...> 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 <MAP...> 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.



    David Williams works by day as the national I.T. manager for an Australian labor-hire company and by night as a freelance writer, programmer, examiner, and trainer. You can reach him at ap_dmw@bigpond.com.
    Comment and Contribute

     

     

     

     

     


    (Maximum characters: 1200). You have 1200 characters left.

     

     

    Sitemap
    Thanks for your registration, follow us on our social networks to keep up-to-date