Using Java
Design and code a Swing GUI for a two-player tic-tac-toe(noughts and crosses) game on a 3 * 3 game board. TheJFrame should use a BorderLayoutwith a JLabel in the NORTH region to displaymessages (e.g., who won the game), and a JPanel inthe CENTER region to display the game board. For the game board inthe JPanel , use a GridLayoutmanager with a 3 * 3 layout of JButton’s in eachcell to display the game board. The button labels should initiallybe blank. When a player clicks on an empty button, an appropriate“X” or “O” should be placed in the label field of the button. Ifthere is a winner (three in a row), then the program should displaythe winner in the JLabel located at the top of thewindow. If all nine cells have been filled without a winner, theprogram should indicate that there is a tie.
Samples of a possible game board are shown below, but feel freeto apply another board design or color scheme (within theparameters of the problem above).
Submit program files for all classes in your Tic Tac Toe game,as well as several screen shots showing various points in agame.
Tic Tac Toe Game O X It’s X move. Tic Tac Toe Game 0 x O WINS! 0 0 0 Tic Tac Toe Game 20 x Cat’s game! X O X o Show transcribed image text Tic Tac Toe Game O X It’s X move.
Tic Tac Toe Game 0 x O WINS! 0 0 0
Tic Tac Toe Game 20 x Cat’s game! X O X o
Expert Answer
Answer to Using Java Design and code a Swing GUI for a two-player tic-tac-toe (noughts and crosses) game on a 3 * 3 game board. Th…