-
Notifications
You must be signed in to change notification settings - Fork 0
/
Figure.java
50 lines (39 loc) · 852 Bytes
/
Figure.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
44
45
46
47
48
49
50
/**
* Yuki Tetsuka
* <p>
* Project: DrawJava
* Description: A simple drawing application in Java.
* <p>
* Copyright (c) 2023 Yuki Tetsuka. All rights reserved.
* See the project repository at: https://github.com/ponstream24/DrawJava
*/
package enshuReport2_2023;
import java.awt.Color;
import java.awt.Graphics;
public class Figure extends Coord {
int w, h, width = 1;
boolean isFill;
public Figure() {
color = Color.BLACK;
w = h = 0;
}
public void setWH(int w, int h) {
this.w = w;
this.h = h;
}
public void paintCursor(Graphics g) {
g.setColor(this.color);
if (this.isFill) {
g.fillOval(x - w / 2, y - h / 2, w, h);
} else {
g.drawOval(x - w / 2, y - h / 2, w, h);
}
}
@Override
public Figure clone() {
Figure figure = new Figure();
figure.w = this.w;
figure.h = this.h;
return figure;
}
}