Browse Source

Expanded cell click logic

feature_TicTacToe_BasicPlayfield
kfkama 3 years ago
parent
commit
e684a87d66
  1. 4
      src/main/java/TicTacToe/cell.java
  2. 2
      src/test/java/TicTacToe/TicTacToeGameTest.java

4
src/main/java/TicTacToe/cell.java

@ -22,8 +22,11 @@ public class cell extends JButton {
} }
protected void OnMouseClick() { protected void OnMouseClick() {
if(value == 0) {
value = ttt.player; value = ttt.player;
ttt.endTurn(); ttt.endTurn();
setEnabled(false);
switch (value) { switch (value) {
case 1: setBackground(new Color(255,0,0)); case 1: setBackground(new Color(255,0,0));
break; break;
@ -33,6 +36,7 @@ public class cell extends JButton {
break; break;
} }
} }
}

2
src/test/java/TicTacToe/TicTacToeGameTest.java

@ -5,6 +5,4 @@ import org.junit.jupiter.api.Test;
class TicTacToeGameTest { class TicTacToeGameTest {
} }
Loading…
Cancel
Save