-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlinkingPolygon.java
46 lines (42 loc) · 1.38 KB
/
BlinkingPolygon.java
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
import java.awt.*;
//??????????????????????????????????????????????????????????????????????????
//??How and when is this class called or invoked since we never explicitly
//invoke or refer to it anywhere?? We only go as far down as RP so how, why,
//and when is this reached?????????????????
//??I also never saw this occur in the debug!!!!!!????????????
public class BlinkingPolygon extends RegularPolygon
{
public boolean visible;
public int count;
//??My program won't work without a constructor but in DP the
//book said that if I don't make one when I extend a class that
//the compiler will make one for me??? Obviously this is false?
public BlinkingPolygon(int nsides, int radius, Color c)
{
super(nsides, radius, c);
//"initializes" visible and count
visible = true;
count = 0;
}
//??Still don't know what this does but why not use a different/
//already made draw?????????????????????????????????????????????
public void draw(Graphics g)
{
if(visible)
super.draw(g);
//^Since super invokes draw in RP yet RP does not provide a
//draw method, it goes to DP
//??Does super always just work up the "extends" chain?????
}
public void step()
{
count++;
if(count == 10)
{
//??Don't understand the purpose of this?? Why??
visible = !visible;
//??Don't understand why is would reset count????
count = 0;
}
}
}