All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.multimedia.ImageMap

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----symantec.itools.multimedia.ImageViewer
                           |
                           +----symantec.itools.multimedia.ImageMap

public class ImageMap
extends ImageViewer
Creates clickable hot spots over an image. The programmer defines one or more hot spot rectangles over an image. When the user moves the mouse into a hotspot it is optionally hilighted. When the user clicks on a hot sopt an action event is generated.

See Also:
ImageViewer

Variable Index

 o rects
List of rectangles in this image map.

Constructor Index

 o ImageMap()
Create default image map.
 o ImageMap(boolean)
Create image map with optional highlight.
 o ImageMap(boolean, Image)
Create image map with Image.
 o ImageMap(boolean, String)
Create image map with filename.
 o ImageMap(boolean, URL)
Create image map with URL.

Method Index

 o addRect(ImageMapRect)
Add a hot spot rectangle to the image map using an ImageMapRect.
 o addRect(int, int, int, int)
Add a hot spot rectangle to the image map using coordinates.
 o findRect(int, int)
Determines if a given point is an any of the image map's rectangles.
 o getShowrect()
Obtain the current hilight mode.
 o mouseDown(Event, int, int)
Processes MOUSE_DOWN events.
 o mouseMove(Event, int, int)
Processes MOUSE_MOVE events.
 o mouseUp(Event, int, int)
Processes MOUSE_UP events.
 o overlap(ImageMapRect)
Determines if a rectangle overlaps an existing image map rectangle.
 o setShowrect(boolean)
Change the hilight mode.

Variables

 o rects
  protected Vector rects
List of rectangles in this image map.

Constructors

 o ImageMap
  public ImageMap()
Create default image map. The default image map contains no image, no rectangles, and is set to show rectangles when the users mouse moves within them.

 o ImageMap
  public ImageMap(boolean showrect)
Create image map with optional highlight. This constructor allows control of showrect mode, the mode that shows the map's rectangles when the users mouse moves within them.

Parameters:
showrect - if true the ImageMap will display the map rectangles as the user's mouse moves over them
 o ImageMap
  public ImageMap(boolean showrect,
                  String str) throws MalformedURLException
Create image map with filename. The specified filename is used as the image source.

Parameters:
showrect - if true the ImageMap will display the map rectangles as the user's mouse moves over them
str - name of file containing the image source
Throws: MalformedURLException
thrown if URL cannot be generated from filename
 o ImageMap
  public ImageMap(boolean showrect,
                  URL url) throws MalformedURLException
Create image map with URL. The specified URL is used as the image source.

Parameters:
showrect - if true the ImageMap will display the map rectangles as the user's mouse moves over them
url - URL of file containing the image source
Throws: MalformedURLException
thrown if the URL syntax is invalid
 o ImageMap
  public ImageMap(boolean showrect,
                  Image img) throws MalformedURLException
Create image map with Image. The specified Image is used as the image source.

Parameters:
showrect - if true the ImageMap will display the map rectangles as the user's mouse moves over them
img - image to be displayed by this component

Methods

 o setShowrect
  public void setShowrect(boolean f)
Change the hilight mode. The image map can optionally display the map's rectangles when the user's mouse cursor moves over the rectangle.

Parameters:
f - set true to hilight rectangles
 o getShowrect
  public boolean getShowrect()
Obtain the current hilight mode.

Returns:
true if currently hilighting image map rectangles
 o addRect
  public boolean addRect(int x,
                         int y,
                         int w,
                         int h)
Add a hot spot rectangle to the image map using coordinates. This rectangle is added to this list of hot spots for this image map.

Parameters:
x - horizontal position of new rectangle
y - vertical position of the new rectangle
w - width of the new rectangle
h - height of the new rectangle
Returns:
true if the rectangle was added, false if the rectangle overlaps another rectangle and was not added
 o addRect
  public boolean addRect(ImageMapRect r)
Add a hot spot rectangle to the image map using an ImageMapRect. This rectangle is added to this list of hot spots for this image map.

Parameters:
r - rectangle to be added to the map
Returns:
true if the rectangle was added, false if the rectangle overlaps another rectangle and was not added
 o findRect
  public ImageMapRect findRect(int x,
                               int y)
Determines if a given point is an any of the image map's rectangles.

Parameters:
x - horizontal location of point to check
y - vertical location of point to check
Returns:
null if the point is not in a rectangle, otherwise returns the rectangle in which the point was found
 o overlap
  public boolean overlap(ImageMapRect new_r)
Determines if a rectangle overlaps an existing image map rectangle.

Parameters:
new_r - the rectangle to compare to existing list
Returns:
true if the rectangle overlaps any existing rectangle in this image map
 o mouseMove
  public boolean mouseMove(Event e,
                           int x,
                           int y)
Processes MOUSE_MOVE events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_MOVE event. These events occur when the mouse is moved around inside this component while the button is NOT pressed. It has been overridden here to hilight the image map rectangles as needed.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
true if the event was handled
Overrides:
mouseMove in class Component
See Also:
mouseDrag, handleEvent
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
Processes MOUSE_DOWN events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_DOWN event. These events occur when the mouse button is pressed while inside this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseDown in class Component
See Also:
mouseUp, handleEvent
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
Processes MOUSE_UP events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_UP event. These events occur when the mouse button is released while inside this component. If the MOUSE_UP occured in the same map rectangle that the mouse down occured in, an ACTION_EVENT is generated and directed to the ImageMapRect in which the event occured.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
true if the event was handled
Overrides:
mouseUp in class Component
See Also:
mouseDown, handleEvent

All Packages  Class Hierarchy  This Package  Previous  Next  Index