TheProgramIt is found on the Internet and is a simple clock display program.
CodeFeatures:
The Clock Code provides various interfaces that can be set in the HTML file to change the colorful clock model. For parameter descriptions, see the info array in the code.
The clock is drawn usingDual-buffer graphics processing mechanismThat is, the image is first drawn in the buffer zone, and then displayed on the webpage can effectively prevent flickering.
In addition, the clock is constantly drawn by reading the system time through a thread. If the time changes, the clock is drawn. UseOne thread draws and one thread processes webpagesCompared with the applet setting standard.
Code (because the code is too long, a download link will be provided and will not be posted)
The HMS class is a time conversion class.
Clockhand is an abstract base class for drawing pointers. It also provides a method to convert degrees into coordinates.
Sweephand is a class used to draw seconds.
Hmhand is a class used to draw hour-minute-hand needles.
An example of HTML used for testing:
my clock Program
display the time of Zone 8
after the program is compiled, a new. htm file is created in the same directory, enter the test code and save it. When you open it in a browser, you can see the clock.