Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Analog Clock Using JavaFX, make an analog clockface that shows an hour hand, a minute hand, and a second hand. The hands should update every

Analog Clock

Using JavaFX, make an analog clockface that shows an hour hand, a minute hand, and a second hand. The hands should update every second. The second hand can be implemented as a dot or as a thin hand.

It is not necessary to place numbers or tick markers on the clock, but that would be added niceness.

Also, the UI should include a Text area that shows the current time as text, such as "Sunday, August 12, 2018 1:11pm".

You will have to use a timer that will go off once a second to run a task that will get the system time, and then interpret that time on the face of the JavaFX clock.

Here is a method that will make this project easier to implement. I've handled all the trigonometry. Note there are 2*image text in transcribed radians in a circle. You may also wish to use the Math.toRadians(double degrees) method to convert degrees to radians.

 /** * Create a JavaFX Line, given a start point, a length and an angle. * @param angle the angle in radians starting counterclockwise from horizontal. */ private Line makeLine(Point2D start, double length, double angle) { double incrementX = length*Math.cos(angle); double incrementY = -length*Math.sin(angle); // negative because y values inverted Point2D end = start.add(new Point2D(incrementX, incrementY)); Line l = new Line(start.getX(), start.getY(), end.getX(), end.getY()); return l; } 

Further hint: the mapping from hour to angle, or from minute to angle, or from seconds to angle is linear. If you cannot figure them out, email me and I will provide them. Note that 3 o'clock maps to an angle of 0. 12 o'clock maps to an angle of pi/2 (for the hour hand, that is).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago