-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameStateTile.java
More file actions
39 lines (29 loc) · 940 Bytes
/
GameStateTile.java
File metadata and controls
39 lines (29 loc) · 940 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class GameStateTile extends Tile implements MouseListener {
// This tile is basically just a button that sits at coordinate in the GridLayout (x, y), and when clicked marks the solution using GameWindow.markSolution()
public GameStateTile(int x, int y) {
super(x, y);
this.add(new JLabel("MARK"));
this.setBackground(Color.red);
this.addMouseListener(this);
}
@Override
public void mouseClicked(MouseEvent mouseEvent) {
GameWindow.markSolution();
}
@Override
public void mousePressed(MouseEvent mouseEvent) {
}
@Override
public void mouseReleased(MouseEvent mouseEvent) {
}
@Override
public void mouseEntered(MouseEvent mouseEvent) {
}
@Override
public void mouseExited(MouseEvent mouseEvent) {
}
}