I\'ve created a class that extends the awt.Polygon class. I\'m trying to write a method that given the PathIterator of the polygon and a Point representing a vertex, adds th
Try using the "addPoint(x, y)" method, except write your own version (or override it) such that it lets you specify where the point is inserted in the series of points (e.g. first, second, third, etc.).
So, write a class that inherits from java.awt.Polygon public class InsertablePolygon extends java.awt.Polygon, and define a method on it, something like, public void insertPoint(int index, Point additionalPoint).
Inside the additionalPoint method, you should have direct access to the int[] xpoints and int[] ypoints arrays, which store the information. Simply modify those arrays (or copy them, insert your point, and then replace them), and you should be good.