-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXRectangleShape.java
More file actions
30 lines (28 loc) · 1.37 KB
/
Copy pathXRectangleShape.java
File metadata and controls
30 lines (28 loc) · 1.37 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
/*
* ===============================================================================
* RectangleShape.java : A shape that is a xrectangle.
* NAME: JANHAV KHANNA
* YOUR UPI: JKHA639
* DATE: 20/05/21
* DESCRIPTION: This is the xrectangle shape class which handles the values and drawing of the shape XRectangle.
* =============================================================================== */
import java.awt.*;
class XRectangleShape extends RectangleShape {
/** constructor to create a rectangle with default values */
public XRectangleShape() { super(); }
public XRectangleShape(int x, int y, int width, int height, int marginwidth, int marginheight, Color bordercolor, Color fillcolor, PathType pathtype){
super(x, y, width, height, marginwidth, marginheight, bordercolor, fillcolor, pathtype);
}
public XRectangleShape(int x, int y, int width, int height, int marginwidth, int marginheight, Color bordercolor, Color fillcolor, PathType pathtype, String t){
super(x, y, width, height, marginwidth, marginheight, bordercolor, fillcolor, pathtype, t);
}
/** draw the rectangle with the fill colour
* If it is selected, draw the handles
* @param g the Graphics control */
@Override
public void draw(Painter g2d) {
super.draw(g2d);
g2d.drawLine(x, y, x+width, y+height);
g2d.drawLine(x+width, y, x, y+height);
}
}