-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameBoardButton.java
More file actions
38 lines (32 loc) · 811 Bytes
/
GameBoardButton.java
File metadata and controls
38 lines (32 loc) · 811 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
package edu.sdccd.cisc191;
import javafx.scene.control.Button;
/**
* Extends the basic JavaFX Button with game functionality
*/
public class GameBoardButton extends Button {
private int row;
private int col;
private boolean hasFish;
private boolean isGuessed;
public GameBoardButton(int row, int col, boolean hasFish)
{
this.row = row;
this.col = col;
this.hasFish = hasFish;
// TODO: set min/pref width, default text
setText("?");
setMinWidth(50.0);
}
public void handleClick() {
// TODO: update text
if(hasFish) {
// TODO "<><"
setText("<><");
} else {
// TODO "X"
setText("X");
}
isGuessed = true;
setDisabled(true);
}
}