A classic Java Applet clock Program (csdn blog migration)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.