Post a New Question

Programming Java

posted by .

I have to create an analog clock..What methods should i use

  • Programming Java -

    You might try some of the following links:


  • Programming Java -

    It is a very interesting problem, regarding time (clock).

    First, most computers use local time, which in general is related to universal time (commonly called GMT) with a number of hours of difference.

    If you are contented with a clock that has the seconds hand moving every second, you may consider the "Timer" class, which allows you to start the clock and have a call to a given method regularly thereafter, a second, or a minute, etc.

    If you want to completely synchronize with the computer clock, you may be better off using the Calendar class, which allows you to count the number of milliseconds since January 1st, 1970, and move the hands accordingly.

    Of course, you would require to draw the clock and the hands. Depending on your ambition, you could draw the hands with a simple arrow, or with a width, etc. You can handle all these using the class.

    There are plenty of examples on the net, the following is one example:
    Try to dig up others and compare the methods each one uses.

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions

Post a New Question