java 2D
Hello Java Friends,
I wanted to draw a shape e.g. (triangle or a figure with more nodes) and then connect each node to the rest nodes with a line. It works only up to 3 nodes (triangle). Can someone give me some idea on how to solve the problem.
See code below:
//draw the line
GeneralPath circleLine =new GeneralPath(GeneralPath.WIND_EVEN_ODD, xPoints.length);
circleLine.moveTo(xPoints[0]+ circleSize[0]/2, yPoints[0] + circleSize[0]/2);
g2d.setColor(Color.green);
g2d.setStroke(new BasicStroke(1));
for (int index = 1; index < xPoints.length; index++){
for (int indey = 1; indey < yPoints.length; indey++){
circleLine.lineTo(xPoints[indey] + circleSize[0]/2, yPoints[indey] + circleSize[0]/2);
}
}
circleLine.closePath();
g2d.draw(circleLine);
Thanks,
Jona_T

