-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoord.java
More file actions
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
*/
package enshuReport2_2023;
import java.awt.Color;
import java.awt.Graphics;
import java.io.Serializable;
public class Coord implements Serializable {
int x, y;
Color color = Color.BLACK;
public Coord() {
this.x = this.y = 0;
}
public void move(int dx, int dy) {
this.x += dx;
this.y += dy;
}
public void moveto(int x, int y) {
this.x = x;
this.y = y;
}
public void paint(Graphics g) {
// Override用
}
public void paintLine(Graphics g, int x, int y) {
// Override用
}
@Override
public Coord clone() {
Coord coord = new Coord();
coord.x = this.x;
coord.y = this.y;
coord.color = this.color;
return coord;
}
}