DhHotSpot Class

DhHotSpot Class

This Package | All Packages

DhStyleBase
  |
  +--DhElement
    |
    +--DhHotSpot
public class DhHotSpot
extends DhElement

Represents a hotspot in an image map. A hotspot is an area within the map that a user can click to jump to a URL. DhHotSpot objects are to be added to DhImageMap objects.

Fields
Name Description
SHAPE_CIRCLE The hotspot is of circular shape.
SHAPE_POLYGON The hotspot is of polygon shape.
SHAPE_RECTANGLE The hotspot is of rectangluar shape.

Constructors
Name Description
DhHotSpot() Creates a rectangle of 0 height and 0 width.
DhHotSpot( int nShape, String strCoords, String strUrl ) One-step constructor.
DhHotSpot( int nShape, String strCoords, DhHyperlink hl ) One-step constructor.
DhHotSpot( Rectangle r ) Topic under construction.
DhHotSpot( Polygon p ) Topic under construction.

Methods
Name Description
getAltText() Retreives the current alternate text string that is displayed if the browser cannot display the image.
getCoords() Retreives the current coordinate string.
getCoordsIntArray() Retrieves a integer array representing the current coordinate string.
getShape() Returns the current shape constant.
getTargetWindow() Retrieves the target window for this hotspot.
getURL() Retrieves the URL to navigate to if the user selects this DhHotSpot.
setAltText( String strAltText ) Sets the alternate text for the hotspot if the browser cannot display the image.
setCoords( int[] nCoordArray ) Sets the coordiante string for this DhHotSpot using an array of integers.
setCoords( String strCoords ) Sets the current coordinate string.
setCoords( Polygon p ) Topic under construction.
setFromHyperlink( DhHyperlink hl ) Sets the URL and target window of this DhHotSpot equal to those set in the DhHyperlink specified.
setShape( int nShape ) Sets the shape of this DhHotSpot.
setTargetWindow( String strTargetWnd ) Sets the target window for this hotspot.
setURL( String strUrl ) Sets the URL for this DhHotSpot to navigate to.

Fields

DhHotSpot.SHAPE_CIRCLE

Syntax
public static final int SHAPE_CIRCLE;
Description
The hotspot is of circular shape. Coordinates are specified as "center x, center y, radius"

Example: "12, 19, 7"

DhHotSpot.SHAPE_POLYGON

Syntax
public static final int SHAPE_POLYGON;
Description
The hotspot is of polygon shape. Coordinates are specified as three or more coordinate pairs.

Example: "10,10,15,15,5,15" creates a triangle

DhHotSpot.SHAPE_RECTANGLE

Syntax
public static final int SHAPE_RECTANGLE;
Description
The hotspot is of rectangluar shape. Coordinates are specified as "top, left, width, height"

Example: "5,5,10,20"

Constructors

DhHotSpot.DhHotSpot

Syntax 1
public DhHotSpot();
Description

Creates a rectangle of 0 height and 0 width. This is the default.



Syntax 2
public DhHotSpot( int nShape, String strCoords, String strUrl );
Parameters
nShape
The shape of the hotspot.
strCoords
A coordinate string appropriate to the shape.
strUrl
The URL to navigate to when the hotpot is clicked.
Description

One-step constructor.

See Also
SHAPE_RECTANGLE, SHAPE_POLYGON, SHAPE_CIRCLE



Syntax 3
public DhHotSpot( int nShape, String strCoords, DhHyperlink hl );
Parameters
nShape
The shape of the hotspot.
strCoords
A coordinate string appropriate to the shape.
hl
A DhHyperlink from which to extract a URL and target window.
Description

One-step constructor.

See Also
SHAPE_RECTANGLE, SHAPE_POLYGON, SHAPE_CIRCLE



Syntax 4
public DhHotSpot( Rectangle r );
Description

Topic under construction.



Syntax 5
public DhHotSpot( Polygon p );
Description

Topic under construction.

Methods

DhHotSpot.getAltText

Syntax
public String getAltText();
Description

Retreives the current alternate text string that is displayed if the browser cannot display the image.

DhHotSpot.getCoords

Syntax
public String getCoords();
Return Value

Returns the string of the current coordinates.

Description

Retreives the current coordinate string.

DhHotSpot.getCoordsIntArray

Syntax
public int[] getCoordsIntArray();
Return Value

Returns an array of integers.

Description

Retrieves a integer array representing the current coordinate string.

DhHotSpot.getShape

Syntax
public int getShape();
Return Value

Returns The shape.

Description

Returns the current shape constant.

See Also
SHAPE_RECTANGLE, SHAPE_POLYGON, SHAPE_CIRCLE

DhHotSpot.getTargetWindow

Syntax
public String getTargetWindow();
Return Value

Returns the target window name.

Description

Retrieves the target window for this hotspot.

DhHotSpot.getURL

Syntax
public String getURL();
Return Value

Returns the current URL.

Description

Retrieves the URL to navigate to if the user selects this DhHotSpot.

DhHotSpot.setAltText

Syntax
public void setAltText( String strAltText );
Parameters
strAltText
The new alt text string.
Description

Sets the alternate text for the hotspot if the browser cannot display the image.

DhHotSpot.setCoords

Syntax 1
public void setCoords( int[] nCoordArray );
Parameters
nCoordArray
The array of coordinates.
Description

Sets the coordiante string for this DhHotSpot using an array of integers.

Exceptions

RuntimeException thrown if the coordinates do not match the current shape type.



Syntax 2
public void setCoords( String strCoords );
Parameters
strCoords
A string of coordinates appropriate for this shape type.
Description

Sets the current coordinate string.

Exceptions

RuntimeException thrown if the coordinates do not match the current shape type.



Syntax 3
public void setCoords( Polygon p );
Description

Topic under construction.

DhHotSpot.setFromHyperlink

Syntax
public void setFromHyperlink( DhHyperlink hl );
Parameters
hl
The DhHyperlink with the settings to copy.
Description

Sets the URL and target window of this DhHotSpot equal to those set in the DhHyperlink specified.

DhHotSpot.setShape

Syntax
public void setShape( int nShape );
Parameters
nShape
The new shape constant.
Description

Sets the shape of this DhHotSpot.

See Also
SHAPE_RECTANGLE, SHAPE_POLYGON, SHAPE_CIRCLE

DhHotSpot.setTargetWindow

Syntax
public void setTargetWindow( String strTargetWnd );
Parameters
strTargetWnd
The name of the new target window.
Description

Sets the target window for this hotspot.

DhHotSpot.setURL

Syntax
public void setURL( String strUrl );
Description

Sets the URL for this DhHotSpot to navigate to.