-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyBoundedShape.java
More file actions
41 lines (41 loc) · 1.05 KB
/
Copy pathMyBoundedShape.java
File metadata and controls
41 lines (41 loc) · 1.05 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
import java.awt.*;
//this class creates bounded shapes such as ovals or rectangle
public abstract class MyBoundedShape extends MyShape
{
//properties
private boolean full;
//constructor gets parameters to initialize shape
public MyBoundedShape(int a, int b, int c, int d, Color col, boolean f)
{
super (a, b, c, d, col);
this.full=f;
}
//this method gets other shape and return true if the new shape has the same width and height as the exist shape
public boolean equals(MyBoundedShape shape)
{
int width, height;
width=shape.getX2();
height=shape.getY2();
if (this.getX2()==width && this.getY2()==height)
return true;
else
return false;
}
//getters & setters
public boolean getFull()
{
return this.full;
}
public void setFull(boolean full) {
this.full=full;
}
//change status of full property to the opposite status
public void changeFull()
{
if (this.full==true)
setFull(false);
else
setFull(true);
}
public abstract void drawShape(Graphics g);
}//end of class