Creating a Shape Using Lines and Curves - Java 2D Graphics

Java examples for 2D Graphics:Path

Description

Creating a Shape Using Lines and Curves

import java.awt.geom.GeneralPath;

public class Main {
  public void main(String[] argv) {
    GeneralPath shape = new GeneralPath();
    shape.moveTo(x, y);
    shape.lineTo(x, y);
    shape.quadTo(controlPointX, controlPointY, x, y);
    shape.curveTo(controlPointX1, controlPointY1, controlPointX2,
        controlPointY2, x, y);
    shape.closePath();
  }
}

Related Tutorials