4

So, to append a rectangle to a Path, you can do this

    Path2D rect = new Path2D.Double();
    rect.append(new Rectangle(10, 10, 100, 10), true);

What I want to do is something like this:

    Path2D circ = new Path2D.Double();
    circ.append(new Circle(... params) true);

Is there a way to do this? Thanks.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
nick
  • 309
  • 1
  • 5
  • 15

1 Answers1

4

You would use an Ellipse2D and give it symmetric parameters.

e.g..,

circ.append(new Ellipse2D.Double(x, y, w, h), true); // where w == h

To see all the classes that inherit from java.awt.Shape please check out its API.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373