Question: JAVA help Create a 2-player Tic Tac Toe. Match the given style and implied functionality as closely as possible. X wins After each click, check
JAVA help
Create a 2-player Tic Tac Toe. Match the given style and implied functionality as closely as possible. X wins
After each click, check to see if the game has ended. If X or O wins, show the appropriate message. If there's a tie, show the appropriate message. After the game ends, reset the board. The first click on a empty cell should put X on the button. The next click on an empty cell should put O on the button. Follow this pattern for the rest of the game. If the user clicks on a button that already has an X or O, do nothing.
Replace the button label text with pictures instead
this is my current code:
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TicTacToe extends JFrame implements ActionListener { JButton board[]=new JButton[9]; boolean turn=true; int boxFilled=0; public TicTacToe() { super.setTitle("Tic Tac Toe"); super.setSize(300, 300); super.setDefaultCloseOperation(EXIT_ON_CLOSE); buildPanel(); super.setVisible(true); } public void buildPanel() { GridLayout g = new GridLayout(3, 3); super.setLayout(g); for(int i=0; i this code works however, it does not provide pictures Can an expert help me implement .png photos into my code while replacing the button label text with pictures
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
