Image Magnets

This applet allows you to define a series of images that may be moved about in the applet's area with mouse-dragging motions (like magnets on a refrigerator/metal surface). The example below uses 'puzzle piece' shaped GIFs. Final destination coordinates (upper-left corner of image) may be defined for each image magnet; if a specific magnet is released near its final point (within VARIANCE pixels), it will snap to that final point.


The applet may be downloaded for free by clicking on the TAR-file link below (read the FAQ if you're not sure what to do with a TAR file). The FAQ also has step by step instructions on how to embed an applet into your own webpage.


Once unTARed, you should find the following classes (plus a '.jar' file if you want to use the archive= attribute in the <applet> tag):


Below are descriptions of all the parameters you may use to customize the applets to your webpages. Be sure to enclose any parameters that contain white space in double-quotation marks. Most parameters have default values in case you do not specify your own values, but the first two parameters (AUTHOR and COPYRIGHT) are necessary. If you are not sure how to incorporate an applet into a webpage (with its parameter names and values), looks at the source of this webpage and the applet embedded for an example, or read the FAQ page.

  • AUTHOR: This parameter must appear exactly as follows:
    <param name=AUTHOR value="Eric Harshbarger,">

  • COPYRIGHT: This parameter must appear exactly as follows:
    <param name=COPYRIGHT value="ImageMagnets applet, Copyright 1999, Eric Harshbarger">

  • BGCOLOR: This parameter indicates the background color of the applet. Consult the FAQ page if you are unsure what format to use for the parameter's value.

  • BACKGROUND: This parameter points to an image file that is used as a background to the applet. All the various texts of the applet will be painted on top of this image. Consult the FAQ page if you are unsure about what image formats you may use.

  • IMAGE.#: This series of parameters (IMAGE.0, IMAGE.1,...) defines the images that will be randomly placed in the applet area. Optionally, after the image file, x-y coordinates may be define (separated by spaces). These coordinates indicate the 'final position' of the upper left corner of the image, and if the image is released with VARIANCE pixels of this final point, it will automatically be positioned exactly at that point (it is used in the example above so that the puzzle pieces 'fall into place' exactly). The coordinates may be omitted if no such final point is desired for a particualr image.

  • VARIANCE: This is the number of pixels an image's upper left corner must be near its 'final point' in order for it to automatically shift to that point when released. The default is 2.

    The Applet Depot and all associated applets, text, scripts, and images, Copyright © 1998-2002 by Eric Harshbarger unless otherwise noted. 'Java' is a registered trademark of Sun Microsystems Incorporated.