-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoly.java
More file actions
50 lines (46 loc) · 1.33 KB
/
Poly.java
File metadata and controls
50 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Gerard Ortega, 171668
I have not discussed the Java language code
in my program with anyone
other than my instructor or the teaching
assistants assigned to this course.
I have not used Java language code
obtained from another student, or
any other unauthorized source, either
modified or unmodified.
If any Java language
code or documentation used in my program was
obtained from another source, such as a text
book or course notes, those have been clearly
noted with a proper citation in the
comments of my code. */
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import java.util.*;
public class Poly extends BasicShape implements DrawingObject
{
//x and y determine the top-left of the square
protected ArrayList<Point2D.Double> pointList;
public Poly(double x, double y, Color fillColor)
{
super(x,y,fillColor);
pointList = new ArrayList<Point2D.Double>();
}
public Poly(Point2D.Double p, Color fillColor)
{
this(p.x,p.y,fillColor);
}
public void addPoint(Point2D.Double p)
{
pointList.add(p);
}
public void draw(Graphics2D g2d, AffineTransform reset)
{
Path2D.Double p = new Path2D.Double();
p.moveTo(x,y);
for(int i = 0; i < pointList.size(); i++)
p.lineTo(pointList.get(i).x,pointList.get(i).y);
drawShape(g2d,p);
}
public void animate(){}
}