In this article, we shall be animating the applet window to show an Analog Clock with a 1-second delay. The idea is to display the system time of every instance.
Each hand of the clock will be animating with 1-second delay keeping one end at the centre. The position of the other end can be derived by the system time. The angle formed by a hand of the clock in every second will be different throughout its journey. This is why various instances make a different angle to the horizontal line.
How to run:
1. Save the file as analogClock.java and run the following commands. 2. javac analogClock.java 3. appletviewer analogClock.java
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.