-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClubClass.java
43 lines (35 loc) · 1.46 KB
/
ClubClass.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
// Author: Matthew Leung
// ICS4U1 Final Project
// Penguin Solitaire
import java.awt.*; // Java's Abstract Windowing Toolkit package - includes class Color
public class ClubClass extends SuitClass
{
public void draw (Graphics g)
{
int iPointsX[] = new int [5];
int iPointsY[] = new int [5];
iPointsX [0] = getCenterX () - getWidth () / 2;
iPointsY [0] = getCenterY ();
iPointsX [1] = getCenterX () + getWidth () / 2;
iPointsY [1] = getCenterY ();
iPointsX [2] = getCenterX ();
iPointsY [2] = getCenterY () - getHeight () / 2;
iPointsX [3] = getCenterX () - getWidth () / 2;
iPointsY [3] = getCenterY () - getHeight () / 4;
iPointsX [4] = getCenterX ();
iPointsY [4] = getCenterY () - getHeight () / 4;
int triPointsX[] = new int [3];
int triPointsY[] = new int [3];
triPointsX [0] = getCenterX ();
triPointsY [0] = getCenterY () - getHeight () / 4;
triPointsX [1] = getCenterX () - getWidth () / 8;
triPointsY [1] = getCenterY () + getHeight () / 2;
triPointsX [2] = getCenterX () + getWidth () / 8;
triPointsY [2] = getCenterY () + getHeight () / 2;
g.setColor (getColor ());
g.fillOval (iPointsX [3], iPointsY [3], getWidth () / 2, getHeight () / 2);
g.fillOval (iPointsX [4], iPointsY [4], getWidth () / 2, getHeight () / 2);
g.fillOval (getCenterX () - getWidth () / 4, getCenterY () - 4 * (getHeight () / 7), getWidth () / 2, getHeight () / 2);
g.fillPolygon (triPointsX, triPointsY, 3);
}
}