-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBanner.java
More file actions
46 lines (42 loc) · 1.33 KB
/
Banner.java
File metadata and controls
46 lines (42 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
/* 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.*;
public class Banner extends BasicShape implements DrawingObject
{
private double size;
private int triangleCount;
public Banner(double x, double y, Color c, double size, int triangleCount)
{
super(x,y,c);
this.size = size;
this.triangleCount = triangleCount;
}
public void draw(Graphics2D g2d, AffineTransform reset)
{
Square s = new Square(x,y,size,(Color)fillColor);
s.draw(g2d,reset);
double tSize = size/(double)triangleCount;
double sqrt3 = Math.sqrt(3);
for(int i = 0; i < triangleCount; i++)
{
RegularPolygon spike = new RegularPolygon(x+size-i*tSize-tSize/2.0, y+size+tSize/(2.0*sqrt3), 3, tSize, (Color)fillColor, Math.PI);
spike.draw(g2d,reset);
}
}
public void animate(){}
}