|
package areas;
import java.awt.*;
import java.util.List;
import java.util.ArrayList;
public class PolygonArea extends Area{
public List<Point> vertices;
public PolygonArea(){
}
return "poly";
}
s += String. format("%d,%d;", p. x, p. y);
}
if(s == ""){return "";}
return s.substring(0, s.length() - 1);
}
int n = vertices.size();
int xPoints[] = new int[n];
int yPoints[] = new int[n];
for(int i = 0; i < n; i++){
Point p = vertices. get(i );
xPoints[i] = p.x;
yPoints[i] = p.y;
}
g.fillPolygon(xPoints, yPoints, n);
}
}
|
|