import java.applet.*; import java.awt.*; import java.net.*; import java.util.*; import java.io.*; public class Imagemap extends Applet { protected Image image; // image to display. protected Vector rects; // list of rectangles in it. // init // public void init() { Graphics g = this.getGraphics(); g.drawString("trying to get image",25,50); // load the image to be displayed. image = this.getImage(this.getDocumentBase(),this.getParameter("image")); // lookup a list of rectangular areas and URLs they map to. rects = new Vector(); ImagemapRectangle r; int i = 0; while ( (r=getRectangleParameter("rect"+i)) != null) { rects.addElement(r); i++; } } // destroy // // Called when the applet is being unloaded from the system. // We use it here to "flush" the image. They may result in memory // and other resources being freed quicker than they otherwise would. public void destroy() {image.flush(); } // paint // // Display the image public void paint(Graphics g) { g.drawImage(image,0,0,this); } // update // // We override this method so that it doesn't clear the background // before calling paint(). Makes for less flickering in some situations. public void update(Graphics g) { paint(g); } // findrect // // Find the rectangle we're inside private ImagemapRectangle findrect(int x, int y) { int i; ImagemapRectangle r = null; for (i=0; i