a. In Chapter 9, you created a Tic Tac Toe game in which you used a 2D
Question:
a. In Chapter 9, you created a Tic Tac Toe game in which you used a 2D array of characters to hold Xs and Os for a player and the computer. Now create a JPanel that uses an array of nine JButtons to represent the Tic Tac Toe grid. When the user clicks a button that has not already been taken, place an X on the button and then allow the computer to place an O on a different button. Announce the winner when either the computer or the player achieves three marks in sequence, or announce that the game was a tie. Figure 16-44 shows a typical game in progress and after the player has won. Save the game as JTicTacToe.java.
b. Add a graphic that displays a large letter representing the winning player of the JTicTacToe game. Draw a large X, O, or, in case of a tie, an overlapping X and O in different colors. Save the game as JTicTacToe2.java.
Tic Tac Toe Tic Tạc Toe Choose one button Choose one button X Game over! You win! Figure 16-44 Typical execution of the JTicTacToe program
Step by Step Answer:
a import javaxswing import javaawt import javaawtevent public class JTicTacToe extends JPanel implements ActionListener JLabel greeting new JLabelTic Tac Toe JLabel promptLabel new JLabelChoose one bu...View the full answer
Students also viewed these Computer science questions
-
In Chapter 9 you created a database for the Wine Depot consisting of a Wine Products table, a Winery table, and a Buyer table. You also created an initial query, form, and report. Barbara has now...
-
In Chapter 9 you created a database for Kelly's Boutique consisting of a Book table, a Department table, and a Publisher table. You also created an initial form, query, and report. Kelly would now...
-
In Chapter 9 you created a database for the Snick's Board Shop consisting of a Products table, a Category table, and a Manufacturer table. You also created an initial query, form, and report. Caitlin...
-
Which of the following is not a suggested procedure to establish internal control over cash disbursements? The bank statement is reconciled monthly. Anyone can sign the checks. Blank checks are...
-
The construction of a histogram for a data set reveals that the distribution is approximately normal and the box plot is constructed with these quartiles: Q1 = 62, Q2 = 70, Q3 = 78. Estimate the...
-
19-3. Compare los medios de comunicacin tradicionales y las redes sociales en trminos de tiempo de entrega de la comunicacin.
-
E14.10. Reverse Engineering for Starbucks Corporation (Medium) In January 2008, the 738.3 million outstanding shares of Starbucks Corporation traded at $20 each. Analysts' consensus carning-per-share...
-
You are a manager at Glass Inc.a mirror and window supplier. Recently, you conducted a study of the production process for your single- side encapsulated window. The results from the study are...
-
How do i find the accounting rate of return? Columber Corp, management is considering purchasing a machine that will cost $117.250 and will be depreciated on a straight-line basis over a five-year...
-
The Laiterie de Coaticook in the Eastern Townships of Quebec produce several types of cheddar cheese. It markets this cheese in four vareties: aged 2 months, 9 months, 15 months and 2 years. At the...
-
Write an application that extends JPanel and displays a phrase in every font size from 6 through 20. Save the file as JFontSizesPanel.java.
-
You developed an interactive GUI application for Carlys Catering. Now, design a JPanel that uses graphics to display a logo for the company, and modify the GUI application to include it. Save the...
-
In Problems 7 18, reduce each rational expression to lowest terms. y - 25 2y8y-10
-
Turn this information into an excel sheets with the excel formulas being shown P12.2 (LO 1, 2) (Liability Entries and Adjustments) Listed below are selected transactions of Schultz Department Store...
-
1. Consider an undirected random graph on the set of four vertices {A, B, C, D} such that each of the 4 2 = 6 potential edges exists with probability 0.2, independently of the presence/absence of any...
-
Basic Net Present Value Analysis Jonathan Butler, process engineer, knows that the acceptance of a new process design will depend on its economic feasibility. The new process is designed to improve...
-
Determine the support reactions at the smooth collar A and the normal reaction at the roller support B. 800 N 600 N B 0.8 m 0.4 m 0.4 m 0.8 m
-
A plant hopes to cool a steam line by sending it through a throttling valve to expand it to atmospheric pressure. The steam enters the valve at 550C and 250 bar. The expansion in the valve happens so...
-
What is the amount to which $1550 will grow from June 10, 2022, to December 15, 2022, at 6.5%?
-
Assume that a trial balance is prepared with an account balance of $21,360 listed as $21,630 and an account balance of $1,500 listed as $15,000. Identify the transposition and the slide.
-
Write an application that uses a loop to create the pattern of Os shown in Figure 6-32, in which each O is displayed one additional space to the right. Save the file as DiagonalOs.java.
-
you created a program named Triangle in which you displayed a seven-line triangle pattern like the one in Figure 6-33 by using a series of println() statements. Now, using your knowledge of loops,...
-
Write an application that allows a user to enter any number of student quiz scores until the user enters 99. If the score entered is less than 0 or more than 10, display an appropriate message and do...
-
Imagine you are an Investor in the Stock Market. Identify three companies in the Korean Stock Market (KOSPI) where you would like to invest. Explain your answer
-
Domino is 4 0 years old and is married out of community of property with the exclusion of the accrual system to Dolly ( 3 5 ) . They have one child, Domonique, who is 1 1 years old. Domino resigned...
-
YOU ARE CREATING AN INVESTMENT POLICY STATEMENT FOR JANE DOE General: 60 years old, 3 grown children that are living on their own and supporting themselves. She is in a very low tax rate so we don't...
Study smarter with the SolutionInn App