80 CHAPTER5. OBJECTSANDGRAPHICS
PointMethods
Point(x,y)Constructsa pointhavingthegivencoordinates.
getX()Returnsthexcoordinateofa point.
getY()Returnstheycoordinateofa point.
LineMethods
Line(point1, point2)Constructsa linesegmentfrompoint1topoint2.
setArrow(string)Setsthearrowheadstatusofa line.Arrowsmaybedrawnateitherthefirstpoint,
thelastpoint,orboth.Possiblevaluesofstringare’first’,’last’,’both’, and’none’.
Thedefaultsettingis’none’.
getCenter()Returnsa cloneofthemidpointofthelinesegment.
getP1(), getP2()Returnsa cloneofthecorrespondingendpointofthesegment.
CircleMethods
Circle(centerPoint,radius)Constructsa circlewithgivencenterpointandradius.
getCenter()Returnsa cloneofthecenterpointofthecircle.
getRadius()Returnstheradiusofthecircle.
getP1(), getP2()Returnsa cloneofthecorrespondingcornerofthecircle’s boundingbox.Theseare
oppositecornerpointsofa squarethatcircumscribesthecircle.
RectangleMethods
Rectangle(point1, point2)Constructsa rectanglehavingoppositecornersatpoint1andpoint2.
getCenter()Returnsa cloneofthecenterpointoftherectangle.
getP1(), getP2()Returnsa cloneofcornerpointsoriginallyusedtoconstructtherectangle.
OvalMethods
Oval(point1, point2)Constructsanoval in theboundingboxdeterminedbypoint1andpoint2.
getCenter()Returnsa cloneofthepointat thecenteroftheoval.
getP1(), getP2Returna cloneofthecorrespondingpointusedtoconstructtheoval.
PolygonMethods
Polygon(point1, point2,point3, ...)Constructsa polygonhavingthegivenpointsasver-
tices.
getPoints()Returnsa listcontainingclonesofthepointsusedtoconstructthepolygon.