Prompt: Using your knowledge of Java GUI components create atic-tac-toe program.
ID: 3615416 • Letter: P
Question
Prompt: Using your knowledge of Java GUI components create atic-tac-toe program. For the text you may use an X/O or a0/1.The program must check across, diagonally, and down. If thereis no winner display this to the user.
Once a winner or no winner is determined, reset the game foranother play.
Below is The driver program:
___________________________________________________________________________________________________________
import java.awt.*;import javax.swing.JFrame;import javax.swing.JOptionPane;import javax.swing.JPanel;import java.awt.event.*;public class TicTacToeDriver {/** The main method acts as a game driver. Panels are created* in GamePlay class methods and returned to the driver.* The panels are added to the frame and then displayed. All* of the game is carried out via the GamePlay class.*/public static void main(String[] args){GameBoard b = new GameBoard ();JFrame frame = new JFrame (" Tic Tac Toe Board");frame.getContentPane().add(b,BorderLayout.EAST);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack ();frame.setVisible (true);}} Prompt: ___________________________________________________________________________________________________________ import java.awt.*;import javax.swing.JFrame;import javax.swing.JOptionPane;import javax.swing.JPanel;import java.awt.event.*;public class TicTacToeDriver {/** The main method acts as a game driver. Panels are created* in GamePlay class methods and returned to the driver.* The panels are added to the frame and then displayed. All* of the game is carried out via the GamePlay class.*/public static void main(String[] args){GameBoard b = new GameBoard ();JFrame frame = new JFrame (" Tic Tac Toe Board");frame.getContentPane().add(b,BorderLayout.EAST);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack ();frame.setVisible (true);}}
Explanation / Answer
x.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.