- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFigure.java
More file actions
Latest commit
50 lines (39 loc) · 852 Bytes
/
Copy pathFigure.java
File metadata and controls
50 lines (39 loc) · 852 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
/**
* 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
*/
packageenshuReport2_2023;
importjava.awt.Color;
importjava.awt.Graphics;
publicclassFigureextendsCoord {
intw, h, width = 1;
booleanisFill;
publicFigure() {
color = Color.BLACK;
w = h = 0;
}
publicvoidsetWH(intw, inth) {
this.w = w;
this.h = h;
}
publicvoidpaintCursor(Graphicsg) {
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
publicFigureclone() {
Figurefigure = newFigure();
figure.w = this.w;
figure.h = this.h;
returnfigure;
}
}