FileDocCategorySizeDatePackage
ImageMap.javaAPI DocExample1473Thu Apr 03 15:17:06 BST 1997None

ImageMap

public class ImageMap extends Canvas

Fields Summary
Image
theMap
Vector
areas
AppletContext
ac
Constructors Summary
public ImageMap(Image img, AppletContext browser)


    theMap = img;
    // make sure the Image is loading
    theMap.getWidth(this);
    ac = browser;
    areas = new Vector();
  
Methods Summary
public voidaddMapArea(java.lang.String s)


    if (s.startsWith("rect")) {
      try {
        RectArea r = new RectArea(s);
        areas.addElement(r);
      }
      catch (MalformedURLException e) {
        System.err.println(e);
      }
    }
    else if (s.startsWith("circle")) {
      ;
    }
    else if (s.startsWith("poly")) {
      ;
    }
    else if (s.startsWith("oval")) {
      ;
    }
    else {  // unrecognized tag
      ;
    }
    
  
public java.awt.DimensionminimumSize()

  
    return new Dimension(theMap.getWidth(this), theMap.getHeight(this));
  
  
public booleanmouseDown(java.awt.Event evt, int x, int y)

    for (Enumeration e = areas.elements() ; e.hasMoreElements() ;) {
      MapArea a = (MapArea) e.nextElement();
      if (a.contains(x, y)) {
        ac.showDocument(a.getURL());
        break;
      }
    }
    return true;
  
  
public voidpaint(java.awt.Graphics g)

   
     if(!g.drawImage(theMap, 0, 0, this)) {
       g.drawString("Loading Picture. Please hang on", 25, 50);
     }
     
  
public java.awt.DimensionpreferredSize()

  
    return minimumSize();