I created a few points and added them to a LinkedList. I am trying to loop through each point, drawing a line between it and all the other points. I created these 2 for loops to do just that, however, only the second one loops through the LinkedList. There are 4 points in the list during my testing.
Here is my code:
public void draw(Graphics2D g){
g.setColor(Color.BLACK);
g.setStroke(new BasicStroke(10));
System.out.println("Linked List Size: " + points.size());
for(int i = 0; i < points.size(); i++){
System.out.println("Current Point: " + points.get(i));
Point2D tempPoint = points.get(i);
for(i = 0; i < points.size(); i++){
Point2D tempEndPoint = points.get(i);
g.drawLine((int)tempPoint.getX(), (int)tempPoint.getY(), (int)tempEndPoint.getX(), (int)tempEndPoint.getY());
System.out.println("" + (int)tempPoint.getX() + " " + (int)tempPoint.getY() + " " + (int)tempEndPoint.getX() + " " +(int)tempEndPoint.getY());
}
}
}
The print statement's are just for testing purposes. Thanks.