- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoord.java
More file actions
Latest commit
53 lines (42 loc) · 905 Bytes
/
Copy pathCoord.java
File metadata and controls
53 lines (42 loc) · 905 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
/**
* 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;
importjava.io.Serializable;
publicclassCoordimplementsSerializable {
intx, y;
Colorcolor = Color.BLACK;
publicCoord() {
this.x = this.y = 0;
}
publicvoidmove(intdx, intdy) {
this.x += dx;
this.y += dy;
}
publicvoidmoveto(intx, inty) {
this.x = x;
this.y = y;
}
publicvoidpaint(Graphicsg) {
// Override用
}
publicvoidpaintLine(Graphicsg, intx, inty) {
// Override用
}
@Override
publicCoordclone() {
Coordcoord = newCoord();
coord.x = this.x;
coord.y = this.y;
coord.color = this.color;
returncoord;
}
}