org.formaria.swt
Class HotspotImage

java.lang.Object
  extended by Canvas
      extended by org.formaria.swt.Image
          extended by org.formaria.swt.HotspotImage
All Implemented Interfaces:
ImageHolder
Direct Known Subclasses:
ImageMap

public class HotspotImage
extends Image

A widget for displaying an image and associating hotspots at coordinates specified in an external file

Copyright: Copyright (c) Formaria Ltd., 2008
License: see license.txt


Field Summary
protected  int currentHotspotIdx
          true to draw the hotspots as highlighted areas
protected static Cursor defaultCursor
          The default cursor
protected static Cursor handCursor
          The default pointer - the hand cursor
protected  java.util.Vector hotspots
          The hotspots
protected  java.util.Vector names
          The hotspot names
protected  java.util.Vector tooltips
          The hotspot tooltiptexts
 
Fields inherited from class org.formaria.swt.Image
currentProject
 
Constructor Summary
HotspotImage(java.lang.Object parent)
          Constructor.
 
Method Summary
protected  void addCustomHotspot(XmlElement ele)
          Add a custom hotspot
 int checkHotspot(MouseEvent e)
          Check the mouse event with the hotspots
 java.lang.String getName(int i)
          Get the name of a hotspot
 void mouseMove(MouseEvent e)
          Refresh the display when the mouse moves
 void read(java.io.Reader r)
          Read a file to store the hotspots
 
Methods inherited from class org.formaria.swt.Image
checkSubclass, getAlignment, getImageName, getToolTip, isFull, isScale, paint, setAlignment, setBg, setFull, setImage, setImageName, setScale, setToolTip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentHotspotIdx

protected int currentHotspotIdx
true to draw the hotspots as highlighted areas


handCursor

protected static Cursor handCursor
The default pointer - the hand cursor


defaultCursor

protected static Cursor defaultCursor
The default cursor


hotspots

protected java.util.Vector hotspots
The hotspots


names

protected java.util.Vector names
The hotspot names


tooltips

protected java.util.Vector tooltips
The hotspot tooltiptexts

Constructor Detail

HotspotImage

public HotspotImage(java.lang.Object parent)
Constructor. Sets cursors and creates the Vector which stores the hotspots. Adds a new MouseListener to the image

Parameters:
parent - parent object
Method Detail

mouseMove

public void mouseMove(MouseEvent e)
Refresh the display when the mouse moves


checkHotspot

public int checkHotspot(MouseEvent e)
Check the mouse event with the hotspots

Parameters:
e - MouseEvent
Returns:
index of the hotspot

read

public void read(java.io.Reader r)
Read a file to store the hotspots

Parameters:
r - Reader

addCustomHotspot

protected void addCustomHotspot(XmlElement ele)
Add a custom hotspot

Parameters:
ele - XmlElement

getName

public java.lang.String getName(int i)
Get the name of a hotspot

Parameters:
i - index of the hotspot
Returns:
name