DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links