public class PathBuilder extends Object
PathBuilder builder = new PathBuilder(); builder.moveTo(p1).lineTo(p1).close(); GeneralPath path = builder.createPath();
Constructor and Description |
---|
PathBuilder()
Make a new path builder with a default color of black.
|
PathBuilder(Color color)
Make a path builder that will make a path with a particular color.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the path.
|
PathBuilder |
color(Color color)
Sets the color if this path.
|
GeneralPath |
createPath()
Create and return the final path.
|
PathBuilder |
cubicTo(javax.vecmath.Point2d cp1,
javax.vecmath.Point2d cp2,
javax.vecmath.Point2d ep)
Make a cubic curve in the path, with two control points.
|
PathBuilder |
lineTo(javax.vecmath.Point2d point)
Make a line in the path, from the last point to the given point.
|
PathBuilder |
moveTo(javax.vecmath.Point2d point)
Make a move in the path, without drawing anything.
|
PathBuilder |
quadTo(javax.vecmath.Point2d cp,
javax.vecmath.Point2d ep)
Make a quadratic curve in the path, with one control point.
|
public PathBuilder()
public PathBuilder(Color color)
color
- the color of the pathpublic PathBuilder moveTo(javax.vecmath.Point2d point)
point
- the point to move topublic PathBuilder lineTo(javax.vecmath.Point2d point)
point
- the point to make a line topublic PathBuilder quadTo(javax.vecmath.Point2d cp, javax.vecmath.Point2d ep)
cp
- the control point of the curveep
- the end point of the curvepublic PathBuilder cubicTo(javax.vecmath.Point2d cp1, javax.vecmath.Point2d cp2, javax.vecmath.Point2d ep)
cp1
- the first control pointcp2
- the second control pointep
- the end point of the curvepublic void close()
public PathBuilder color(Color color)
color
- the new Color
.public GeneralPath createPath()
Copyright © 2018. All Rights Reserved.