Shapes
The new package java.awt.geom.*, also new in JDK1.2, includes a set of newclasses that implement the interface Shape.
- Ellipse2D.Double, Rectangle2D.Double, Arc2D.Double, RoundRectangle2D.Double, and Line2D.Double
- There are also versions of each with .Float that takes float args.
There is also a new class General Path for constructing shapes.
- Create an empty path: gp = new GeneralPath ( );
- Move to a position: gp.moveTo ( x0, y0 );
- Extend the path in several ways:
- Straight lines: gp.lineTo ( x1, y1 );
- Bezier curves: gp.curveTo ( x1, y1, x2, y2, x3, y3 );
- Quadratic curves: gp.quadTo ( x1, y1, x2, y2 );
- End the path: gp.closePath ( );