This repository was archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyShape.java
More file actions
80 lines (62 loc) · 1.23 KB
/
MyShape.java
File metadata and controls
80 lines (62 loc) · 1.23 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* Jaired Jawed
* Dec 10, 2017
* MyShape.java
*/
import java.awt.Color;
import java.awt.Graphics;
/**
* Class contains coordinates and color of shapes
*/
abstract class MyShape {
private int startX, startY, endX, endY;
private Color color;
public MyShape() {
startX = 0; startY = 0; endX = 0; endY = 0;
color = Color.BLACK;
}
public MyShape(int startX, int startY, int endX, int endY, Color color) {
this.startX = startX;
this.startY = startY;
this.endX = endX;
this.endY = endY;
this.color = color;
}
/**
* Mutator methods
*/
public void setStartX(int startX) {
this.startX = startX;
}
public void setEndX(int endX) {
this.endX = endX;
}
public void setStartY(int startY) {
this.startY = startY;
}
public void setEndY(int endY) {
this.endY = endY;
}
public void setColor(Color color) {
this.color = color;
}
/**
* Accessor methods
*/
public int getStartX() {
return startX;
}
public int getEndX() {
return endX;
}
public int getStartY() {
return startY;
}
public int getEndY() {
return endY;
}
public Color getColor() {
return color;
}
abstract public void draw( Graphics g );
}