FileDocCategorySizeDatePackage
LinkArea.javaAPI DocExample3135Sat Sep 12 03:01:00 BST 1998None

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.6, 12/06/96

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;