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: 66% (6 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).
-
1. What are the options for Red Fish-Blue Fish as far as global intermediaries are concerned? What do you recommend? Why? 2. What other options does Red Fish-Blue Fish have to expand their Asian...
-
Estimate the overall odds ratio of the set of tables in Problem3.6 and test whether the odds ratios are the same across the tables. Problem3.6 is: 3.6 Use the DOS data to test whether there is gender...
-
KC Corporation manufactures an air-freshening device called GoodAir, which it sells to six merchandising firms. The list price of a GoodAir is $ 30, and the full manufacturing costs are $ 18....
-
8) What does the following method do? Rewrite it so it produces the same results but does not use recursion. public static boolean whoKnows (int arr, int i, int j) { if (i >= j) { return true; } else...
-
Cost Estimation at Global Green Books Publishing Global Green Books Publishing is continuing to produce customized eBooks as a key new product line for it as a successful printing and publishing...
-
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,...
-
On December 30, 2015, you buy a Ford Expedition. It comes with a three-year, 60,000-km warranty. On March 5, 2016, you return the Expedition to the dealership for some basic repairs covered under the...
-
The reward-to-risk is 8.7 percent and the risk-free rate is 4.7 percent. What is the expected return on a risky asset if the beta of that asset is 1.28?
-
A plaintif suffered injuries when her bicycle collided with the defendant's motorcycle The plaintf fled a personal injury action against the defendant, alleging that the defendant was operating the...
-
Through his will, Frank arranged to have his 1,000 shares of Ardrox Ltd. transferred to a spousal trust for the benefit of his wife Jutta. The trust indenture specified that Jutta could receive...
-
Ms. Hardin invested $40,000 in three stocks. The first year, stock A paid 6% dividends and increased 3% in value; stock B paid 7% dividends and increased 4% in value; stock C paid 8% dividends and...
-
Finer Pet Foods Corporation (FPF) is a New York Subchapter S corporation that manufactures "human grade" pet food for dogs and cats. FPF offers a whole range of gourmet pet foods and treats, and has...
-
One of the effects of significant global warming would be the melting of part or all of the polar ice caps. This, in turn, would change the length of the day (the period of the Earth's rotation)....
-
Prove the formula for (d/dx)(cos-1x) by the same method as for (d/dx)(sin-1x).
-
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?
-
Tax Evaluation - Beth Johnson's Income from Partnership This activity provides hands - on experience in assessing and reporting partnership incomes, offering insights into the intricacies of tax...
-
For mnay years Capri Limited has delivered onits quality products promise to consumers, ensuring continued access to an ever growing range of extblished and well love brands . Through a spirit on...
-
Management functions would not be complete without the activities of the human resource department. Important to the function of the organization is the human resource management activities. It is...
Study smarter with the SolutionInn App