Rewrite Listing 16.13, ImageAudioAnimation.java, to use the resource bundle to retrieve image and audio files. (Hint: When
Question:
Rewrite Listing 16.13, ImageAudioAnimation.java, to use the resource bundle to retrieve image and audio files. (Hint: When a new country is selected, set an appropriate locale for it. Have your program look for the flag and audio file from the resource file for the locale.)
Data from Listing 16.13,
Listing 16.13 TicTacToe.java
1 import javafx.application.Application;
2 import javafx.stage.Stage;
3 import javafx.scene.Scene;
4 import javafx.scene.control.Label;
5 import javafx.scene.layout.BorderPane;
Transcribed Image Text:
6 import javafx.scene. layout. GridPane; 7 import javafx.scene.layout. Pane; 8 import javafx.scene.paint.Color; 9 import javafx.scene.shape. Line; 10 import javafx.scene.shape. E1lipse; 11 12 public class TicTacToe extends Application { II Indicate which player has a turn, initially it is the X player private char whoseTurn = 'X'; main class TicTacToe 13 14 15 I1 Create and initialize cell private Cell[][] cell = new Cell[3][3]; 16 17 18 II Create and initialize a status label private Label 1b1Status = new Label ("X's turn to play"); 19 20 21 e0verride // Override the start method in the Application class public void start(Stage primaryStage) { // Pane to hold cell GridPane pane = new GridPane (); for (int i = 0; 1 < 3; 1++) for (int j = 0; j < 3; j++) pane. add (cell[i][i] = new Cell ), i, i): 22 23 24 25 hold nine cells 26 27 28 create a cell 29 Border Pane borderPane = new BorderPane (); borderPane. setCenter (pane); borderPane. setBottom(1b1Status): 30 31 tic-tac-toe cells in center 32 label at bottom 33 // Create a scene and place it in the stage Scene scene = new Scene (borderPane, 450, 170); primaryStage.setTitle("TicTacToe"); // Set the stage title primaryStage. setScene (scene); II Place the scene in the stage primaryStage.show (); // Display the stage } 34 35 36 37 38 39 40 1** Determine if the cel1 are all occupied */ public boolean isFull() { for (int i = 0; i < 3; i++) for (int j = 0; j< 3; j++) if (cell[i][j].getToken () == 41 check isFull 42 43 44 45 46 return false; 47 48 return true; } 49 50 1** Determine if the player with the specified token wins */ public boolean iswon(char token) { for (int i = 0; i < 3; i++) if (cell[i][0]. getToken () == token && cell[i][1]- getToken () == token && cell[i][2].getToken () == token) { return true; } 51 52 53 check rows 54 55 56 57 58 59 for (int j = 0;j < 3; j++) if (cell[0][j]. getToken() == token && cell[1][j1. getToken () == token && cell[2][j] - getToken () == token) { return true; } 60 check columns 61 62 63 64 65
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 71% (7 reviews)
Heres a possible implementation of the updated ImageAudioAnimationjava file that uses a resource bun...View the full answer
Answered By
Akshay Shete
I have extensive experience as a tutor, both online and in-person. I have worked with students of all ages and abilities, and am skilled at adapting my teaching style to meet the needs of each individual student. I have a strong background in a variety of subjects, including math, science, and English, and am able to break down complex concepts in a way that is easy for students to understand. In addition to my subject matter expertise, I am also a patient and supportive teacher, and am committed to helping my students succeed. Whether I am working with a struggling student who needs extra help to catch up, or an advanced student looking to get ahead, I am able to provide the guidance and support they need to reach their goals. Overall, my hands-on experience as a tutor has prepared me to be a confident and effective teacher, and I am excited to use my skills to help students succeed.
0.00
0 Reviews
10+ Question Solved
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
When a small boat travels north at 3 mi/h, a flag mounted on its stern forms s an angle = 50? with the centerline of the boat as shown. A short time later, when the boat travels east at 12 mi/h,...
-
It is easier to organize data and retrieve it when there is little or no dependence between programs and data. Why is there more dependence in a file approach and less in the database approach?
-
The data below are the lengths (in seconds) of audio files found on an iPod. There were a total of 10,003 audio files, and 18 files were randomly selected using the Shuffle Songs command. Examine...
-
Your friend Jin is working at Company AUS Toys, an Australian manufacturing company, selling toys to Company Toy Shop. Company Toy Shop also buys toys from Company CNY Toys in China which has fixed...
-
Consider a pair of random variables X, Y with joint density fX,Y(x, y) = 8e-2x-4y, for 0 < x,0, < y, And fX,Y (x, y) = 0 otherwise. Find P(X 4,Y 8).
-
Comparative income statement data for Crane Inc. and Pronghorn Ltd., two competitors, are shown below for the year ended December 31, 2021. Crane Pronghorn Net sales $1,770,000 $527,000 Cost of goods...
-
Two inbred cultivars of wheat were hybridised, and seed of 48 F2-derived F3 families (i.e., families in the third progeny generation, each derived by inbreeding from a single plant in the second...
-
Arthur Katz testified for the U.S. government in a stock manipulation case. He also pled guilty and testified against three of his law partners in an insurance fraud case. He received a six-month...
-
January February March Unit data: Beginning Inventory 0 100 100 Production 1,550 1,450 1,500 Sales 1,450 1,450 1,490 Variable Costs: Manufacturing Cost per unit produced $1,000 $1,000 $1,000...
-
Aspirations Ltd commenced trading as wholesale suppliers of office equipment on 1 January 20X1, issuing ordinary shares of £1 each at par in exchange for cash. The shares were fully paid on...
-
Write a server for a client. The client sends the weight and height for a person to the server (see Figure 33.18a). The server computes BMI (Body Mass Index) and sends back to the client a string...
-
Suppose that the scores are stored in the Scores table. The table was created as follows: create table Scores (name varchar(20), score number, permission boolean); insert into Scores values (John,...
-
Calculate the required deposit to be made today so that a series of ten withdrawals of $1,000 each can be made beginning five years from today. Assume an interest rate of 5% per period on end of...
-
In this scenario you are the Manager of a Home and Community Care organization in Victoria. Your organization provides oversees support services for individuals in their homes. The individuals that...
-
find the wind speed and direction for the following parcels. Important note: To determine the arc tangent using the Google calculator, click the box marked "Inv" so that it is a light gray instead of...
-
As consumers we're connected to an instant feed or live updates, breaking news, and messages. We believe that when we post something on social media, we will get instant feedback from friends. What...
-
Describe the process for screening candidates for ethics. Outline which job candidate factors are illegal to consider when hiring. Explain how to obtain accurate behavior information from resumes,...
-
In relation to Operation management, sustainability and supply chain management explain the following terms; What is the overall objective of scheduling? What is JIT? What is a Lean producer? Discuss...
-
Select a property of interest to you, or to an industry contact, for which market research would be interesting. Examine the property, collect what information is available about it, and then write a...
-
Write a paper by answer the following question: Should Recycling Be Mandatory?
-
What is the worst-case time for putting n entries in an initially empty hash table, with collisions resolved by chaining? What is the best case?
-
Show the result of Exercise R-10.6, assuming collisions are handled by quadratic probing, up to the point where the method fails.
-
What would be a good hash code for a vehicle identification number that is a string of numbers and letters of the form 9X9XX99X9XX999999,where a 9 represents a digit and an X represents a letter?
-
business law A partner may actively compete with the partnership True False
-
A company provided the following data: Selling price per unit $80 Variable cost per unit $45 Total fixed costs $490,000 How many units must be sold to earn a profit of $122,500?
-
Suppose a 10-year, 10%, semiannual coupon bond with a par value of $1,000 is currently selling for $1,365.20, producing a nominal yield to maturity of 7.5%. However, it can be called after 4 years...
Study smarter with the SolutionInn App