Module java.desktop
Package java.awt.geom

Class Path2D

java.lang.Object
java.awt.geom.Path2D
All Implemented Interfaces:
Shape, Cloneable
Direct Known Subclasses:
Path2D.Double, Path2D.Float

public abstract sealed class Path2D extends Object implements Shape, Cloneable permits Path2D.Double, Path2D.Float
The Path2D class provides a simple, yet flexible shape which represents an arbitrary geometric path. It can fully represent any path which can be iterated by the PathIterator interface including all of its segment types and winding rules and it implements all of the basic hit testing methods of the Shape interface.

Use Path2D.Float when dealing with data that can be represented and used with floating point precision. Use Path2D.Double for data that requires the accuracy or range of double precision.

Path2D provides exactly those facilities required for basic construction and management of a geometric path and implementation of the above interfaces with little added interpretation. If it is useful to manipulate the interiors of closed geometric shapes beyond simple hit testing then the Area class provides additional capabilities specifically targeted at closed figures. While both classes nominally implement the Shape interface, they differ in purpose and together they provide two useful views of a geometric shape where Path2D deals primarily with a trajectory formed by path segments and Area deals more with interpretation and manipulation of enclosed regions of 2D geometric space.

The PathIterator interface has more detailed descriptions of the types of segments that make up a path and the winding rules that control how to determine which regions are inside or outside the path.

Sealed Class Hierarchy Graph:
Sealed class hierarchy graph for Path2DSealed class hierarchy graph for Path2D
Since:
1.6