Question: Write a program that displays a clock and sets the time with the input from three text fields, as shown in Figure 16.38b. Use the

Write a program that displays a clock and sets the time with the input from three text fields, as shown in Figure 16.38b. Use the ClockPane in Listing 14.21. Resize the clock to the center of the pane.12 3 6 30 Second 4 Minute 45 Hour (b) 1 import

Listing

java.util.Calendar; 2 import java.util.GregorianCalendar; 3 import javafx.scene.layout.Pane; import javafx.scene.paint.Color; 5 import javafx.scene.shape.Circle;

6 import javafx.scene.shape.Line; 7 import javafx.scene.text.Text; 9 public class ClockPane extends Pane

{ private int hour; private int minute; private int second; 10 11

12 3 6 30 Second 4 Minute 45 Hour (b) 1 import java.util.Calendar; 2 import java.util.GregorianCalendar; 3 import javafx.scene.layout.Pane; import javafx.scene.paint.Color; 5 import javafx.scene.shape.Circle; 6 import javafx.scene.shape.Line; 7 import javafx.scene.text.Text; 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 with 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 34 35 /** Set a new hour */ public void setHour(int hour) { this.hour = hour; paintClock (); 36 37 38 39 40 /** Return minute */ public int getMinute() { return minute; 41 42 43 44 45 mmm mmm r

Step by Step Solution

3.52 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program Plan The program displays a clock and that sets the time from the input that is provided by ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!