-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyShape.java
More file actions
73 lines (57 loc) · 970 Bytes
/
MyShape.java
File metadata and controls
73 lines (57 loc) · 970 Bytes
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
package A;
import java.awt.Graphics;
import java.awt.Color;
//Declaration of class MyShape.
public abstract class MyShape{
private int x1;
private int x2;
private int y1;
private int y2;
private Color color;
//constructor
public MyShape(){
x1=0;
x2=0;
y1=0;
y2=0;
color = Color.BLACK;
}
public MyShape(int x1, int x2, int y1, int y2, Color color) {
this.x1 = x1;
this.x2 = x2;
this.y1 = y1;
this.y2 = y2;
this.color = color;
}
public int getX1() {
return x1;
}
public void setX1(int x1) {
this.x1 = x1;
}
public int getX2() {
return x2;
}
public void setX2(int x2) {
this.x2 = x2;
}
public int getY1() {
return y1;
}
public void setY1(int y1) {
this.y1 = y1;
}
public int getY2() {
return y2;
}
public void setY2(int y2) {
this.y2 = y2;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public abstract void draw(Graphics g);
}