How to remove specific element on List?
...
java.util.List<Polygon> triangles = new LinkedList<Polygon>();
Point startDrag, endDrag, midPoint;
Polygon triangle;
....
int[] xs = { startDrag.x, endDrag.x, midPoint.x };
int[] ys = { startDrag.y, startDrag.y, midPoint.y };
triangles.add( new Polygon(xs, ys,3));
....
public void mouseClicked(MouseEvent e) {
...
startDrag = new Point(e.getX(), e.getY());
for (Polygon p:triangles){
if (p.contains(startDrag)) //Polygon has a 'contains(Point)' method
remove (p.contains(startDrag));
}
....