FileDocCategorySizeDatePackage
LinkArea.javaAPI DocSun JDK 1.4.2 Example3273Thu May 12 00:35:29 BST 2005None

LinkArea

public class LinkArea extends ImageMapArea
The classic "Fetch a URL" ImageArea class. This class extends the basic ImageArea Class to fetch a URL when the user clicks in the area.
author
Jim Graham
version
1.12, 01/23/03

Fields Summary
URL
anchor
The URL to be fetched when the user clicks on this area.
Constructors Summary
Methods Summary
public voidenter()
The status message area is updated to show the destination URL.

	showStatus((anchor != null)
		   ? "Go To " + anchor.toExternalForm()
		   : null);
    
public voidexit()
The status message area is updated to show the destination URL.

	showStatus(null);
    
public voidhandleArg(java.lang.String arg)
The argument string is the URL to be fetched.

	try {
	    anchor = new URL(parent.getDocumentBase(), arg);
	} catch (MalformedURLException e) {
	    anchor = null;
	}
    
public booleanisTerminal()
The isTerminal method indicates whether events should propagate to the areas underlying this one.

	return true;
    
public booleanlift(int x, int y)
The new URL is fetched when the user releases the mouse button only if they are still in the area.

	if (inside(x, y) && anchor != null) {
	    showDocument(anchor);
	}
	return true;