Getting a clock hand to go anticlockwise..


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Getting a clock hand to go anticlockwise..

  1. #1
    Join Date
    Sep 2004
    Posts
    37

    Getting a clock hand to go anticlockwise..

    Hi. I have this program:


    import java.awt.*;
    import java.applet.*;

    public class Lines2 extends Applet
    {
    Color blue = new Color(180,255,255);
    Color black = new Color(0,0,0);

    public void paint(Graphics g)
    {
    int x = 0;
    int y = 0;

    double angle = 0;
    while(angle<6.28)
    {
    x = (int)(java.lang.Math.cos(angle)*100) + 120;
    y = (int)(java.lang.Math.sin(angle)*100) + 120;
    g.setColor(black);
    g.drawLine(120,120,x,y);
    for(int delay = 0;delay<2000000;delay++);
    g.setColor(blue);
    g.drawLine(120,120,x,y);
    angle = angle + 0.01;
    }

    g.setColor(black);
    g.drawLine(120,120,x,y);
    }

    }


    I would like to modify the program so that the clock hand sweeps anticlockwise to colour in a circle, then make it sweep the other way to erase the colour. I have tried changing the angles etc but can't get it right. Thanks for your time and help.
    Cheers.
    Steve

  2. #2
    Join Date
    Sep 2004
    Posts
    37
    Problem solved. Thanks anyway.
    Cheers
    Steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center