APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.text.html

pack-priv Class Map

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:serial
Imports
java.awt.Polygon, java.io.Serializable, java.util.StringTokenizer, .Vector, javax.swing.text.AttributeSet

Map is used to represent a map element that is part of an HTML document. Once a Map has been created, and any number of areas have been added, you can test if a point falls inside the map via the contains method.
Author
Scott Violet

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Map.CircleRegionContainment

Used to test for containment in a circular region.

pack-priv static class
Map.DefaultRegionContainment

An implementation that will return true if the x, y location is inside a rectangle defined by origin 0, 0, and width equal to width passed in, and height equal to height passed in.

pack-priv static class
Map.PolygonRegionContainment

Used to test for containment in a polygon region.

pack-priv static class
Map.RectangleRegionContainment

Used to test for containment in a rectangular region.

pack-priv static interface
Map.RegionContainment

Defines the interface used for to check if a point is inside a region.

Field Summary

Modifier and TypeField and Description
private Vector<AttributeSet>
areaAttributes

An array of AttributeSets.

private Vector<Map.RegionContainment>
areas

An array of RegionContainments, will slowly grow to match the length of areaAttributes as needed.

private String
name

Name of the Map.

Constructor Summary

AccessConstructor and Description
public
Map()

public
Map(String name)

Method Summary

Modifier and TypeMethod and Description
public void
addArea(AttributeSet as)

Defines a region of the Map, based on the passed in AttributeSet.

protected Map.RegionContainment
createRegionContainment(AttributeSet attributes)

Creates and returns an instance of RegionContainment that can be used to test if a particular point lies inside a region.

protected static int[]
extractCoords(Object stringCoords)

Creates and returns an array of integers from the String stringCoords.

public AttributeSet
getArea(int x, int y, int width, int height)

Returns the AttributeSet that contains the passed in location, x, y.

public AttributeSet[]
getAreas()

Returns the AttributeSets representing the different areas of the Map.

public String
getName()

Returns the name of the Map.

public void
removeArea(AttributeSet as)

Removes the previously created area.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

areaAttributesback to summary
private Vector<AttributeSet> areaAttributes

An array of AttributeSets.

areasback to summary
private Vector<Map.RegionContainment> areas

An array of RegionContainments, will slowly grow to match the length of areaAttributes as needed.

nameback to summary
private String name

Name of the Map.

Constructor Detail

Mapback to summary
public Map()
Mapback to summary
public Map(String name)

Method Detail

addAreaback to summary
public void addArea(AttributeSet as)

Defines a region of the Map, based on the passed in AttributeSet.

createRegionContainmentback to summary
protected Map.RegionContainment createRegionContainment(AttributeSet attributes)

Creates and returns an instance of RegionContainment that can be used to test if a particular point lies inside a region.

extractCoordsback to summary
protected static int[] extractCoords(Object stringCoords)

Creates and returns an array of integers from the String stringCoords. If one of the values represents a % the returned value with be negative. If a parse error results from trying to parse one of the numbers null is returned.

getAreaback to summary
public AttributeSet getArea(int x, int y, int width, int height)

Returns the AttributeSet that contains the passed in location, x, y. width, height gives the size of the region the map is defined over. If a matching area is found, the AttribueSet for it is returned.

getAreasback to summary
public AttributeSet[] getAreas()

Returns the AttributeSets representing the different areas of the Map.

getNameback to summary
public String getName()

Returns the name of the Map.

removeAreaback to summary
public void removeArea(AttributeSet as)

Removes the previously created area.

javax.swing.text.html back to summary

pack-priv Class Map.CircleRegionContainment

extends Object
implements RegionContainment
Class Inheritance
All Implemented Interfaces
javax.swing.text.html.Map.RegionContainment

Used to test for containment in a circular region.

Field Summary

Modifier and TypeField and Description
pack-priv int
lastHeight

Last value of height passed in.

pack-priv int
lastWidth

Last value of width passed in.

pack-priv float[]
percentValues

Non-null indicates one of the values represents a percent.

pack-priv int
radiusSquared

Radius of the circle.

pack-priv int
x

X origin of the circle.

pack-priv int
y

Y origin of the circle.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastHeightback to summary
pack-priv int lastHeight

Last value of height passed in.

lastWidthback to summary
pack-priv int lastWidth

Last value of width passed in.

percentValuesback to summary
pack-priv float[] percentValues

Non-null indicates one of the values represents a percent.

radiusSquaredback to summary
pack-priv int radiusSquared

Radius of the circle.

xback to summary
pack-priv int x

X origin of the circle.

yback to summary
pack-priv int y

Y origin of the circle.

Constructor Detail

CircleRegionContainmentback to summary
public CircleRegionContainment(AttributeSet as)

Method Detail

containsback to summary
public boolean contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Doc from javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver. width, height is the size of the enclosing region.

javax.swing.text.html back to summary

pack-priv Class Map.DefaultRegionContainment

extends Object
implements RegionContainment
Class Inheritance
All Implemented Interfaces
javax.swing.text.html.Map.RegionContainment

An implementation that will return true if the x, y location is inside a rectangle defined by origin 0, 0, and width equal to width passed in, and height equal to height passed in.

Field Summary

Modifier and TypeField and Description
pack-priv static Map.DefaultRegionContainment
si

A global shared instance.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver.

public static Map.DefaultRegionContainment
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

siback to summary
pack-priv static Map.DefaultRegionContainment si

A global shared instance.

Constructor Detail

DefaultRegionContainmentback to summary
pack-priv DefaultRegionContainment()

Method Detail

containsback to summary
public boolean contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Doc from javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver. width, height is the size of the enclosing region.

sharedInstanceback to summary
public static Map.DefaultRegionContainment sharedInstance()
javax.swing.text.html back to summary

pack-priv Class Map.PolygonRegionContainment

extends Polygon
implements RegionContainment
Class Inheritance
All Implemented Interfaces
javax.swing.text.html.Map.RegionContainment

Used to test for containment in a polygon region.

Field Summary

Modifier and TypeField and Description
pack-priv int
lastHeight

Last value of height passed in.

pack-priv int
lastWidth

Last value of width passed in.

pack-priv int[]
pack-priv float[]
percentValues

If any value is a percent there will be an entry here for the percent value.

Inherited from java.awt.Polygon:
boundsnpointsxpointsypoints

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver.

Inherited from java.awt.Polygon:
addPointcontainscontainscontainscontainscontainscontainsgetBoundingBoxgetBoundsgetBounds2DgetPathIteratorgetPathIteratorinsideintersectsintersectsinvalidateresettranslate

Field Detail

lastHeightback to summary
pack-priv int lastHeight

Last value of height passed in.

lastWidthback to summary
pack-priv int lastWidth

Last value of width passed in.

percentIndexsback to summary
pack-priv int[] percentIndexs
percentValuesback to summary
pack-priv float[] percentValues

If any value is a percent there will be an entry here for the percent value. Use percentIndex to find out the index for it.

Constructor Detail

PolygonRegionContainmentback to summary
public PolygonRegionContainment(AttributeSet as)

Method Detail

containsback to summary
public boolean contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Doc from javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver. width, height is the size of the enclosing region.

javax.swing.text.html back to summary

pack-priv Class Map.RectangleRegionContainment

extends Object
implements RegionContainment
Class Inheritance
All Implemented Interfaces
javax.swing.text.html.Map.RegionContainment

Used to test for containment in a rectangular region.

Field Summary

Modifier and TypeField and Description
pack-priv int
lastHeight

Last value of height passed in.

pack-priv int
lastWidth

Last value of width passed in.

pack-priv float[]
percents

Will be non-null if one of the values is a percent, and any value that is non null indicates it is a percent (order is x, y, width, height).

pack-priv int
x0

Top left.

pack-priv int
x1

Bottom right.

pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver.

public boolean
contains(int x, int y)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastHeightback to summary
pack-priv int lastHeight

Last value of height passed in.

lastWidthback to summary
pack-priv int lastWidth

Last value of width passed in.

percentsback to summary
pack-priv float[] percents

Will be non-null if one of the values is a percent, and any value that is non null indicates it is a percent (order is x, y, width, height).

x0back to summary
pack-priv int x0

Top left.

x1back to summary
pack-priv int x1

Bottom right.

y0back to summary
pack-priv int y0
y1back to summary
pack-priv int y1

Constructor Detail

RectangleRegionContainmentback to summary
public RectangleRegionContainment(AttributeSet as)

Method Detail

containsback to summary
public boolean contains(int x, int y, int width, int height)

Implements javax.swing.text.html.Map.RegionContainment.contains.

Doc from javax.swing.text.html.Map.RegionContainment.contains.

Returns true if the location x, y falls inside the region defined in the receiver. width, height is the size of the enclosing region.

containsback to summary
public boolean contains(int x, int y)
javax.swing.text.html back to summary

pack-priv Interface Map.RegionContainment

Known Direct Implementers
javax.swing.text.html.Map.RectangleRegionContainment, javax.swing.text.html.Map.PolygonRegionContainment, javax.swing.text.html.Map.CircleRegionContainment, javax.swing.text.html.Map.DefaultRegionContainment

Defines the interface used for to check if a point is inside a region.

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(int x, int y, int width, int height)

Returns true if the location x, y falls inside the region defined in the receiver.

Method Detail

containsback to summary
public boolean contains(int x, int y, int width, int height)

Returns true if the location x, y falls inside the region defined in the receiver. width, height is the size of the enclosing region.