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 and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Android | How to display Analog clock and Digital clock
- Java Applet | How to display a Digital Clock
- Difference between a Java Application and a Java Applet
- Java Applet Basics
- Draw a Polygon in Java Applet
- Java Code for Moving Text | Applet | Thread
- Draw a ellipse and a rectangle in Java Applet
- Java Applet | Implementing Flood Fill algorithm
- Java Applet | Digital Stopwatch
- Draw a Chessboard in Java Applet
- Draw an Olympic Symbol in Java Applet
- Draw a Smiley in Java Applet
- Java Applet | Draw a line using drawLine() method
- Java Clock tickMinutes() method in Java with Examples
- Java Clock withZone() method in Java with Examples
- Java 8 Clock instant() method with Examples
- Java 8 Clock hashCode() method with Examples
- Java 8 Clock getZone() method with Examples
- Java 8 Clock fixed() method with Examples
- Java 8 Clock millis() Method with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.