Modify Listing 14.21, ClockPane.java, to add the animation into this class and add two methods start() and
Question:
Modify Listing 14.21, ClockPane.java, to add the animation into this class and add two methods start() and stop() to start and stop the clock. Write a program that lets the user control the clock with the Start and Stop buttons, as shown in Figure 15.36a.
Listing
Transcribed Image Text:
12 3 6. Stop Start (a) 1 import java.util.Calendar; 2 import java.util.GregorianCalendar; 3 import javafx.scene.layout.Pane; 4 import javafx.scene.paint.Color; 5 import javafx.scene.shape.Circle; 6 import javafx.scene.shape.Line; 7 import javafx.scene.text.Text; 8 9 public class ClockPane extends Pane { private int hour; private int minute; private int second; 10 11 12 13 // Clock pane's width and height private double w = 250, h = 250; 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 /** Construct a default clock wi th the current time*/ public ClockPane() { setCurrentTime(); /** Construct a clock with specified hour, minute, and second */ public ClockPane(int hour, int minute, int second) { this.hour - hour; this.minute - minute; this.second = second; paintClock (); /** Return hour */ public int getHour() { return hour; 31 32 33 34 35 36 37 /** Set a new hour */ public void setHour(int hour) { this.hour = hour; paintClock (); 38 39 40 { 41 /** Return minute */ public int getMinute() { return minute; 42 43 44 45
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 77% (9 reviews)
Program Plan Create a class called ClockAnimation that extends JFrame class Instantiate StillClock o...View the full answer
Answered By
Sidharth Jain
My name is Sidharth. I completed engineering from National Institute of Technology Durgapur which is one of the top college in India. I am currently working as an Maths Faculty in one of the biggest IITJEE institute in India. Due to my passion in teaching and Maths, I came to this field. I've been teaching for almost 3 years.
Apart from it I also worked as an Expert Answerer on Chegg.com. I have many clients from USA to whom I teach online and help them in their assignments. I worked on many online classes on mymathlab and webassign. I guarantee for grade 'A'.
4.90+
3+ Reviews
10+ 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
-
Rewrite Programming Exercise using a thread to control the clock animation. Modify Listing, ClockPane.java, to add the animation into this class and add two methods?start()?and?stop()?to start and...
-
The program in Listing 28.14 lets the user enter an input for the nine tails problem from the console and displays the result on the console. Write a program that lets the user set an initial state...
-
Rewrite Programming Exercise 5.21 to create a GUI, as shown in Figure 16.41b. Your program should let the user enter the loan amount and loan period in the number of years from text fields, and it...
-
The income statement information for 2010 and 2011 of the Connor Company (a sole proprietorship) is as follows: Required Fill in the blanks labeled (a) through (g). All the necessary information is...
-
Let B(X) be the space of bounded functionals on a metric space X (example 2.11). Let T: B(X) B(X) be an increasing function with property that for every constant c T(f + c) = T(f) + c for every f ...
-
Solve Problem 4.1 by the mesh current method. Data from Problem 4.1 Use branch currents in the network shown in Fig. 4-17 to find the current supplied by the 60-V source. 60 V (+ 70 www 120 60 h 12 0
-
On February 16, 2005, Joseph and Margaret Buset borrowed $192,000 from Fremont Investment & Loan (the Originator). The loan was secured by a mortgage on a residential condominium. The mortgage named...
-
Printware Products Inc. produces printers for wholesale distributors. It has just completed packaging an order from Hawes Company for 450 printers. Before the order is shipped, the controller wants...
-
If your BN CO wants to fund an activity scheduled to occur in November 2023, and today is February 16, 2023, who would be the best person to advise on this activity? S4, S6, or S8? Also, if the CO...
-
Colton Furniture Co. is a small but fast-growing manufacturer of living room furniture. Its two principal products are end tables and sofas. The flow diagram for the manufacturing at Colton follows....
-
A self-avoiding walk in a lattice is a path from one point to another that does not visit the same point twice. Selfavoiding walks have applications in physics, chemistry, and mathematics. They can...
-
Write a program that animates a pendulum swinging, as shown in Figure 15.35. Press the UP arrow key to increase the speed and the DOWN key to decrease it. Press the S key to stop animation and the R...
-
Indicate whether each of the following types of transactions will either (a) Increase owners equity (b) Decrease owners equity: 1. expenses 2. owners investments 3. owners withdrawals 4. revenues
-
Summarise the steps required to report your concerns about the risk of harm to the child in the scenario. (Approximately 400 words) In your summary, discuss each of the following key points: What...
-
explain in depth how individual employees differ for tax purposes from independent contractors, For vs From AGI, how deductions and credits work, etc.
-
Due professional care, the third general standard is concerned with what is done by the independent auditor and how well it is done. For example, due care in the matter of audit documentation...
-
Students should select an organization or a section in an organization. 1. You should document the accounting information that is process within the organization or section. 2. What accounting...
-
Joe is 30 years old. She is single and has private health insurance with no dependents. Joe also received $13,000 in cash dividends from her investment in BHP Billiton' s fully franked shares. and a...
-
The Isle of Palms Company (IOP), a U.S.-based entity, has a wholly owned subsidiary in Israel that has been determined as having the Israeli shekel (ILS) as its functional currency. On October 1,...
-
The first national bank pays a 4% interest rate compound continuously. The effective annual rate paid by the bank is __________. a. 4.16% b. 4.20% c. 4.08% d. 4.12%
-
Many computer applications involve searching through a set of data and sorting the data. A number of efficient searching and sorting algorithms have been devised in order to reduce the runtime of...
-
Consider the following piece of C code: for (j=2;j <1000;j++) D[j] = D[j1]+D[j2]; Th e MIPS code corresponding to the above fragment is: Instructions have the following associated latencies (in...
-
Consider the following recursive mergesort algorithm (another classic divide and conquer algorithm). Mergesort was first described by John Von Neumann in 1945. The basic idea is to divide an unsorted...
-
On January 1, 2019, Jerome Company purchased nontrading equity investments which are irrevocably designated at FVOCI Purchase Transaction price Market value December 31, 2019 cost Security A Security...
-
Identify the revision of the sentence that removes fillers without changing the meaning of the sentence. Isabella was looking for the gross income total in the report when she said she was absolutely...
-
You are considering investing in the following 10 year cash flow. If you required rate of return is 8%, what is the current value of this project? Assume all cash flows occur at the end of the year....
Study smarter with the SolutionInn App