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...
-
The liver is an organ that plays important roles in multiple organ systems. What role does the liver play in digestion? What role does it play in excretion?
-
Explain what is meant by the term qualifying asset in the context of foreign currency transactions. Describe the accounting treatment for exchange differences that relate to qualifying assets.
-
The Village of Parry reported the following for its Print Shop Fund for the year ended April 30, 2012. The Print Shop Fund records also revealed the following: 1. Contribution from General Fund for...
-
The Reading Warehouse distributes hardback books to retail stores and extends credit terms of 2/7, n/30 to all of its customers. During the month of June the following inventory transactions...
-
John Sullivan started a business. During the first month (February 20--), the following transactions occurred. Show the effect of each transaction on the accounting equation: Assets = Liabilities +...
-
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...
-
Why can we say that having a pure non- competitive inhibitor present is similar to just having less enzyme present?
-
An engine operating at 2 9 . 4 6 % efficiency is doing 0 . 3 2 kJ of work. How much heat is exhausted to the surrounding, in J ?
-
A boy with a mass of 29.3 kg on the top of a platform 7.1 m high preparing for a dive into the pool below. What will be his Kinetic Energy in Joules as he hits the water? (if needed use 10 m/s for g)
-
In organizational behavior, what does "role identity" refer to ? The formal job description provided by the organization Personal characteristics of an individual The way an individual perceives and...
-
Persuasive writing expresses opinions to convince a reader about a matter, it seeks influence therefore it is written with _ _ _ _ _ _ _ _ _ ? Specificity Subjectivity Objectivity Relativism
-
the software security team has been taksed with identifying who will be involved when security vulnerabilites are reported from external enties. they are creating a raci matrix that will identify...
-
Broussard Skateboard's sales are expected to increase by 15% from $8 million in 2016 to $9.2 million in 2017. Its assets totaled $5 million at the end of 2016. Broussard is already at full capacity,...
-
The senior management at Davis Watercraft would like to determine if it is possible to improve firm profitability by changing their existing product mix. Currently, the product mix is determined by...
-
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...
-
A function is given. r(t) = 5 - t; t = 5, t = 10 (a) Determine the net change between the given values of the variable. (b) Determine the average rate of change between the given values of the...
-
Why are certain functional dependencies called trivial functional dependencies? Explain what is meant by repetition of information and inability to represent information. Explain why each of these...
-
When is a table in BCNF? Explain what this means and provide a specific example? What is a surrogate key, and when should you use one? Give specific examples ? What is normalization? Why is it...
Study smarter with the SolutionInn App