public static Path2D createPath( boolean close, double... points ) {
		Path2D path = new Path2D.Float( Path2D.WIND_NON_ZERO, points.length / 2 + (close ? 1 : 0) );
		path.moveTo( points[0], points[1] );
		for( int i = 2; i < points.length; ) {
			double p = points[i];
			if( p == MOVE_TO ) {
				// move pointer to
				//    params: x, y
				path.moveTo( points[i + 1], points[i + 2] );
				i += 3;
			} else if( p == QUAD_TO ) {
				// add quadratic curve
				//    params: x1, y1, x2, y2
				path.quadTo( points[i + 1], points[i + 2], points[i + 3], points[i + 4] );
				i += 5;
			} else if( p == CURVE_TO ) {
				// add bezier curve
				//    params: x1, y1, x2, y2, x3, y3
				path.curveTo( points[i + 1], points[i + 2], points[i + 3], points[i + 4], points[i + 5], points[i + 6] );
				i += 7;
			} else if( p == ROUNDED ) {
				// add rounded corner
				//    params: x, y, arc
				double x = points[i + 1];
				double y = points[i + 2];
				double arc = points[i + 3];

				// index of next point
				int ip2 = i + 4;
				if( points[ip2] == QUAD_TO || points[ip2] == ROUNDED )
					ip2++;

				// previous and next points
				Point2D p1 = path.getCurrentPoint();
				double x1 = p1.getX();
				double y1 = p1.getY();
				double x2 = points[ip2];
				double y2 = points[ip2 + 1];

				double d1 = distance( x, y, x1, y1 );
				double d2 = distance( x, y, x2, y2 );
				double t1 = 1 - ((1 / d1) * arc);
				double t2 = (1 / d2) * arc;

				path.lineTo( lerp( x1, x, t1 ), lerp( y1, y, t1 ) );
				path.quadTo( x, y, lerp( x, x2, t2 ), lerp( y, y2, t2 ) );

				i += 4;
			} else if( p == CLOSE_PATH ) {
				// close path
				//    params: -
				path.closePath();
				i += 1;
			} else {
				// add line to
				//    params: x, y
				path.lineTo( p, points[i + 1] );
				i += 2;
			}
		}
		if( close )
			path.closePath();
		return path;
	}
Creates an open or closed path for the given points.
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java