|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
One suggestion is to use below-background image placement to provide textual information relating to the link; interesting graphical effects can be achieved with Image overlays. If this applet is designed to be as generic as possible, then it can be written and compiled once, and reused many times with differing effects.
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.net.*;
public class ImageMap extends Applet {
Image background;
boolean overlay;
Vector areas = new Vector();
Vector images = new Vector();
Vector urls = new Vector();
int current = -1;
Vectors are used so that any number of regions may be defined. A Vector is a dynamically allocated array that grows as needed. This is more efficient than a large array for most cases.
init() method does all the work of collecting the parameters. This method is called automatically when the applet first loads. public void init() {
// get the parameters
background = getImage(getDocumentBase(), getParameter("main"));
prepareImage(background, this);
overlay = Boolean.valueOf(getParameter("overlay")).booleanValue();
String bgcolor = getParameter("bgcolor");
if (bgcolor != null)
setBackground (new Color (Integer.parseInt (bgcolor.substring (1), 16)));
boolean ok = true;
for (int i = 1; ok; ++i) {
String areaStr = getParameter("area"+i);
String imageStr = getParameter("image"+i);
String urlStr = getParameter("url"+i);
if ((areaStr != null) && (imageStr != null) && (urlStr != null)) {
try {
StringTokenizer str = new StringTokenizer(areaStr);
Rectangle area = new Rectangle(Integer.parseInt(str.nextToken()),
Integer.parseInt(str.nextToken()),
Integer.parseInt(str.nextToken()),
Integer.parseInt(str.nextToken()));
Image image = getImage(getDocumentBase(), imageStr);
URL url = new URL(getDocumentBase(), urlStr);
areas.addElement(area);
images.addElement(image);
urls.addElement(url);
prepareImage (image, this);
} catch (MalformedURLException ex) {
System.out.println ("Invalid format for URL " + i + " : " + urlStr);
} catch (NoSuchElementException ex) {
System.out.println ("Invalid format for area " + i + " : " + areaStr);
} // end try
} else {
ok = false;
} // end if
} // end for
} // end init
There are several parameters that we need to collect from the HTML APPLET tag. A typical tag will look like this: