Rewrite Listing 15.13 using a thread to animate a flag being raised. Compare the program with Listing
Question:
Rewrite Listing 15.13 using a thread to animate a flag being raised. Compare the program with Listing 15.13 by setting the delay time to 10 in both programs. Which one runs the animation faster?
Listing
Transcribed Image Text:
1 import javafx.animation.PathTransition; 2 import javafx.application. Application; 3 import javafx.scene.Scene; 4 import javafx.scene.image. ImageView; 5 import javafx.scene.layout.Pane; 6 import javafx.scene.shape.Line; 7 import javafx.stage.Stage; 8 import javafx.util.Duration; 10 public class FlagRisingAnimation extends Application { 11 @Override // Override the start method in the Application class 12 public void start(Stage primaryStage) { 13 14 15 16 17 18 19 20 21 // Create a pane Pane pane - new Pane (); // Add an image view and add it to pane ImageView imageView = new ImageView("image/us.gif"); pane.getChildren().add(imageView); // Create a path transition PathTransition pt = new PathTransition(Duration.millis(10000), 22 new Line(100, 200, 100, 0), imageView); 24 pt.play(); // Start animation pt.setCycleCount(5); 26 // Create a scene and place it in the stage Scene scene - new Scene (pane, 250, 200); primarystage.setTitle("FlagRisingAnimation"); // Set the stage title primaryStage.setScene (scene); // Place the scene in the stage primaryStage.show(); // Display the stage 28 29 31 32 }
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (9 reviews)
Program Plan Refer to class FlagRisingAnimation from Listing 1513 and add delay in it using delayProperty function and run it Create a new class FlagR...View the full answer
Answered By
Kainat Shabbir
i am an experienced qualified expert with a long record of success helping clients overcome specific difficulties in information technology, business and arts greatly increasing their confidence in these topics. i am providing professional services in following concerns research papers, term papers, dissertation writing, book reports, biography writing, proofreading, editing, article critique, book review, coursework, c++, java, bootstarp, database.
5.00+
184+ Reviews
255+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Listing 15.17 BallPane.java using a thread to animate bouncing ball movements. Listing 1 import javafx.animation.KeyFrame; 2 import javafx.animation.Timeline; 3 import...
-
Rewrite Programming Exercise 20.5 using a thread to animate bouncing ball movements. The example in Section displays multiple bouncing balls. Extend the example to detect collisions. Once two balls...
-
Rewrite Exercise using a thread to control car racing. Compare the program with Exercise by setting the delay time to 10 in both programs. Which one runs the animation faster? Write a program that...
-
Partners have fiduciary obligations to each other. Explain what this means and give examples.
-
A possible mechanism for the pathology of trinucleotide repeat diseases is aberrant translation in which all three reading frames are used. Which repeating amino acid residues will result from the...
-
Obtain Thvenin and Norton equivalent circuits at terminals ab of the coupled circuit shown in Fig. 14-50. +1 10/0 V+ j5 n mimm 40 4 j8n a b nim j80 40 +1 10/90 V
-
Plaintiff purchases a new car that has defects in its paint job. Three times the dealership repaints the care, but to no avail. The plaintiff continues to drive the car as he has no other option in...
-
Comparative data on three companies in the same service industry are given below: Required: 1. What advantages are there to breaking down the ROI computation into two separate elements, margin and...
-
What are the differences between the Enterprise Edition, Standard Edition, and Standard Edition One installation types of Oracle Database. Which one would be suitable for a small business or a...
-
A driven closed-ended pile, circular in cross section, is shown in Figure P12.7. Calculate the following. a. The ultimate point load using Meyerhofs procedure. b. The ultimate point load using Vesics...
-
Rewrite Listing 30.1 to display the output in a text area, as shown in Figure 30.30. Listing a 1b2b3b 4b 5 b6bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 7 8bbbbbbbbbbbbbbbbbbbb 9bb10 16 11 12 13 14...
-
Write a program that launches 1,000 threads. Each thread adds 1 to a variable sum that initially is 0. Define an Integer wrapper object to hold sum. Run the program with and without synchronization...
-
Explain four factors that investors should consider when selecting ETFs.
-
You are formulating a bid for a 500,000 square feet office building project in Toronto. If the direct costs amount to $12,500,000 and the site overhead costs are $2,500,000, what would be the bid...
-
To create an intangible asset, bmx inc. spent $20,000 in registration fees, $40,000 in attorney fees, and $120,000 in research and development. what amount should bmx record as expense?
-
Calculate the production budget in units - July, august, September , October? Bishop and Co Sales budget for the quarter ended 30 Sept 2018 July August September Total Budgeted sales (units) 8,000...
-
You have been hired as a financial consultant to a company for investigating the possibility of investing in Telford Ltd, which is a taxation category 2 company. Your company has a required rate of...
-
Peter is hesitating about whether he should invest through LIC or ETF. As his financial adviser, you would explain 1) the difference between an ETF and a LIC; 2) what are the advantages and...
-
Your manager advises you that clients Mike and Winona Marsh, residents of Bath, Maine, acquired beachfront property in Maine in 2002 and titled the property in their names as joint tenants with right...
-
On July 1, 2011, Flashlight Corporation sold equipment it had recently purchased to an unaffiliated company for $480,000. The equipment had a book value on Flashlights books of $390,000 and a...
-
Install and compile the Python programs TCPClient and UDPClient on one host and TCPServer and UDPServer on another host. a. Suppose you run TCPClient before you run TCPServer. What happens? Why? b....
-
Suppose that in UDPClient.py, after we create the socket, we add the line: clientSocket.bind((, 5432)). Will it become necessary to change UDPServer.py? What are the port numbers for the sockets in...
-
Can you configure your browser to open multiple simultaneous connections to a Web site? What are the advantages and disadvantages of having a large number of simultaneous TCP connections?
-
What is buzz marketing? Viral marketing? 2. What is relationship marketing? How to use CRM? 3. Appropriate usage of social media. 4. How to develop effective social media practices? 5. Develop a...
-
Total gross sales for the period include the following: Credit card sales (discount 3%) Sales on account (1/15, n/60) $9,600 $11,400 Sales returns related to sales on account were $350. All returns...
-
Arndt, Incorporated reported the following for 2024 and 2025 ($ in millions): Revenues Expenses 2024 $ 942 798 Pretax accounting income (income statement) Taxable income (tax return) Tax rate: 25% $...
Study smarter with the SolutionInn App