* Inform all active ImageAreas of a mouse release.
* Only those areas that were inside the original mousePressed()
* are informed of the mouseReleased.
*/
public void mouseReleased(MouseEvent e)
{
for (int i = 0; i < areas.length; i++) {
if (areas[i].inside(pressX, pressY)) {
if (areas[i].lift(e.getX(), e.getY())) {
break;
}
}
}
e.consume();
}
public void mouseEntered(MouseEvent e)
{}
/**
* Make sure that no ImageAreas are highlighted.
*/
public void mouseExited(MouseEvent e) {
for (int i = 0; i < areas.length; i++) {
areas[i].checkExit();
}
e.consume();
}
/**
* Inform all active ImageAreas of a mouse drag.
* Only those areas that were inside the original mouseDown()
* are informed of the mouseUp.
*/
public void mouseDragged(MouseEvent e)
{
mouseMoved(e);
for (int i = 0; i < areas.length; i++) {
if (areas[i].inside(pressX, pressY)) {
if (areas[i].drag(e.getX(), e.getY())) {
break;
}
}
}
e.consume();
}
/**
* Find the ImageAreas that the mouse is in.
*/
public void mouseMoved(MouseEvent e) {
boolean eaten = false;
for (int i = 0; i < areas.length; i++) {
if (!eaten && areas[i].inside(e.getX(), e.getY())) {
eaten = areas[i].checkEnter(e.getX(), e.getY());
} else {
areas[i].checkExit();
}
}
e.consume();
}
/**
* Scan all areas looking for the topmost status string.
*/
public void newStatus() {
String msg = null;
for (int i = 0; i < areas.length; i++) {
msg = areas[i].getStatus(msg);
}
showStatus(msg);
}
public String getAppletInfo() {
return "Title: ImageMap \nAuthor: Jim Graham \nAn extensible ImageMap applet class. \nThe active areas on the image are controlled by ImageArea \nclasses that can be dynamically loaded over the net.";
}
public String[][] getParameterInfo() {
String[][] info = {
{"area[n]", "delimited string", "This parameter takes the form of <ImageAreaClassName>, <ul>, <ur>, <ll>, <lr>, <action> where ImageAreaClassName is the name of the class from which this feedback area is controlled, the next four arguments are the four corners of the feedback zone, and the final argument is that action that should be taken on click or mouseover. That action can be 1) display text in the status bar (if you provide a string argument), 2) play a sound (if you provide the path to a sound file), or 3) load a page (if you provide a URL)."},
{"rect[n]", "delimited string", "Deprecated: use area[n]"},
{"href[n]", "URL string", "Pass in a URL to create a LinkArea which will point to this URL. Not used in these examples."},
{"highlight", "string/int", "Pass the word 'brighter' followed by an integer 'n' to change the highlight mode to brighter and the hightlight percentage to n. Pass the word 'darker' followed by an integer 'm' to change the highlight mode to darker and the highlight percentage to m. Anything else will be ignored. The default highlight mode is BRIGHTER and the default highlight percentage is 50."},
{"startsound", "path string", "The path of a soundclip to play when the image is first displayed."},
{"img", "path string", "The path to the image to be displayed as a live feedback image map."}