views:

467

answers:

1

Once again I'm doing Java graphics (Graphics2D) but I noticed there is no Polygon.Double or Polygon.Float classes whereas there is Rectangle2D.Float and Rectangle2D.Double class.

Does anyone know why this is? I just need to draw a triangle using doubles as points.

+2  A: 

You can use a Path2D (or a Path2D.Float or Path2D.Double) to get the same effect.

Joachim Sauer
Thanks. I also need to fill this polygon. Is this possible with Path2D?
openidsucks
Yes. `Graphics2D` has a `fill(Shape)` method and `Path2D` is-a `Shape`.
Joachim Sauer