|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to draw clock hands?
ive got a problem. i can display a digital clock using the Date class but i cant seem to figure out how to draw the analog clocks hour, minute and second hands. the center of the clock is (330, 280) and i've tried a few math calculation but cant seem to get it right. i know that the co-ordinate of the other point uses a math calculation eg. x2 = radius * cos theta. How do we calculate the angle theta?
|
|
#2
|
|||
|
|||
|
Well , a circle is 360 degrees and there are 60 minutes in a hour.
So each minutes is 6 degrees (360 /60) Now draw an arc with the number of degrees you calculated. For the rest you should use the same numbers as you used for the clocks outer circle. You should do some additional calculating and adjusting because: a: when you give the number of degrees the arc starts at 15:00 b: the arcis calculated to the left and not the right. After you created the correct Arc use the getEndPoint (Can be a bit different because i'm doing this out of the head) You should now have the endpoint of the minutes line. Draw a line now from the center to the endpoint. You should be able to figure the rest out yourself, I think |
|
#3
|
|||
|
|||
|
Quote:
hey i want help with creating the clock as well. i dont know how to draw da line and like it to the second, minute and hour. if u dont mind cud u pls help me ![]() |
|
#4
|
|||
|
|||
|
Quote:
can u pls help me wid da clock pls ![]() |
|
#5
|
|||
|
|||
|
please some one help me
![]() |
|
#6
|
|||
|
|||
|
hey no worries, i sorted out da program.
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > how to draw clock hands? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|