In order to work in Java 1.5, this implementation uses the GeneralPath class rather than the Path2D class.
GeneralPath
Path2D