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).
-
A particle carrying \(3.00 \mathrm{nC}\) of positive charge is at the origin of a rectangular coordinate system, and a particle carrying \(3.00 \mathrm{nC}\) of negative charge is on the \(x\) axis...
-
This problem looks at the trade-offs between purity measured by \(\mathrm{y}_{\mathrm{I}, \text { out }} / \mathrm{y}_{\text {sugar, out }}\) and sugar recovery in the liquid,...
-
The journal entries for August, Carleys Car Cares second month of business, have been journalized in the general journal in your Working Papers or in CengageNow. The balances of the accounts as of...
-
Associate the following descriptions with their appropriate financial terminology. Answer instructions The procedure comprises planning and projecting the business's financial assets Financial...
-
AAA Company is preparing its 3rd quarter budget and provides the following data: Cash balance at June 30 is projected to be $4,000. The company is required to maintain a minimum cash balance of...
-
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,...
-
Find the expected value of each random variable: a) b) P(X x0.2 0.4 0.4 p(X=x) 0.3 0.41 0.2 0.1
-
Under common law, a CPA may be liable to a client. a. Explain the meaning and importance of the term privity of contract. b. How may an auditor breach a contract? c. What cause ordinarily underlies a...
-
Which data-collection method gathers data from a relatively large number of cases at a particular time? a. Survey b. Observation c. Essay d. Experimental study
-
a. What were the critical issues in (a) the Contine, ital Vending case and (b ) the BarChris case? b. What action was taken by the profession as a result of each case?
-
The portion of the research in which the researcher explains the significance and findings of the study is called . a. Analyzing the data b. Drawing conclusions c. Sample selection d. Selecting the...
-
Which type of research entails manipulation of a situation in some way in order to test a hypothesis? a. Correlational research b. Experimental research c. Evaluation research d. Hypothetical research
-
High Desert Pottery works makes a variety of pottery products that it sells to retailers. The company uses a job-order costing system in which departmental predetermined overhead rates are used to...
-
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?
-
Crisp Cookware's common stock is expected to pay a dividend of $ 2 a share at the end of this year ( D 1 = $ 2 . 0 0 ) ; its beta is 0 . 6 . The risk - free rate is 4 . 8 % and the market risk...
-
60. Determine the number of years John Jobert Joseph Jr must invest his P10000 in a bank that pays 3.9% interest compounded semi-annually to withdraw a lump sum of P15000 in the future. A. 8 years B....
-
The weight of newspaper generated for garbage per month by each household in a particular community follows a normal distribution with mean 28 pounds and standard deviation 5 pounds. If a household...
Study smarter with the SolutionInn App