I made a tic-tac-toe game using swing and a Jpanel. I got it to check for a winner. Now that I have a winner though, I don't want the user to be able to keep putting down more pieces in the game (even if there is room for pieces).
Here I have the last bit of code where _board represents the 3 x 3 board:
if (_board.testcrossDownwards() || _board.testcrossUpwards() || _board.testTopRow() || _board.testMiddleRow() || _board.testBottomRow() ||
_board.testLeftColumn() || _board.testMiddleColumn() || _board.testRightColumn()) {
_message.setText(player_name + " wins!");
} else if (_board.isTicTacRunThru()) {
_message.setText("It's a DRAW!");
} else {
_message.setText("You clicked on " + s.getCoordString() +". " + next_player_name + " to play.");
}
I assume that the piece that I need to add will follow the player_name + " wins!" line.