Java automatically closes the polygons it draws. That is it draws polygons that look like the one on the right rather than the one on the left.
If you don't want your polygons to be closed, you can draw a
polyline instead with the Graphics
class's drawPolyline()
method
public abstract void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)