Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 9th, 2005, 09:11 PM
confirm045 confirm045 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 28 confirm045 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 54 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old March 11th, 2005, 05:25 PM
Hans71 Hans71 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 4 Hans71 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 21 sec
Reputation Power: 0
Lightbulb

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

Reply With Quote
  #3  
Old February 27th, 2007, 03:32 PM
rtn rtn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 4 rtn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 33 sec
Reputation Power: 0
Thumbs up

Quote:
Originally Posted by confirm045
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?


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


Reply With Quote
  #4  
Old February 28th, 2007, 06:59 PM
rtn rtn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 4 rtn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 33 sec
Reputation Power: 0
Quote:
Originally Posted by Hans71
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



can u pls help me wid da clock pls

Reply With Quote
  #5  
Old March 1st, 2007, 08:05 PM
rtn rtn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 4 rtn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 33 sec
Reputation Power: 0
Talking

please some one help me

Reply With Quote
  #6  
Old March 4th, 2007, 08:21 AM
rtn rtn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 4 rtn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 33 sec
Reputation Power: 0
Thumbs down

hey no worries, i sorted out da program.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > how to draw clock hands?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT