- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareGUI.java
More file actions
Latest commit
30 lines (30 loc) · 739 Bytes
/
Copy pathSquareGUI.java
File metadata and controls
30 lines (30 loc) · 739 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
importjavax.swing.*;
importjava.io.*;
importjava.awt.*;
importjava.awt.Graphics.*;
importjavax.imageio.ImageIO;
importjava.awt.image.BufferedImage;
publicclassSquareGUI {
privateintx;
privateinty;
privatebooleanw;
publicSquareGUI(intx, inty, booleanwall) {
this.x = x;
this.y = y;
this.w = wall;
}
publicvoiddraw(Graphicsg) {
if(w) {
g.setColor(newColor(0,0,0));
} else {
g.setColor(newColor(150, 150, 150));
}
g.fillRect(x*Viewer2.size+Viewer2.ox, y*Viewer2.size+Viewer2.oy, Viewer2.size, Viewer2.size);
}
publicintgetRow() {
returnx;
}
publicintgetCol() {
returny;
}
}