import javax.swing.*;
import java.awt.Graphics;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;

public class secondP2 extends JPanel implements Runnable
{   
int t;
Thread runner;

public secondP2(int t1) 
{t=t1;
 runner=new Thread(this);
 runner.start();
}

public Line2D line(double A)
{double teta=((A-t)*2.0*Math.PI)/60.0;
int xx=(int)(150+50.0*Math.cos(teta));
int yy=(int)(150-50.0*Math.sin(teta));
Line2D x3=new Line2D.Double(150,150,xx,yy);
return x3;
}

public void setP(int t1) {t=t1;}

public void paint(Graphics g)
{
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
 RenderingHints.VALUE_ANTIALIAS_ON);
 g2.setStroke(new BasicStroke(2.0f));
 Ellipse2D x=new Ellipse2D.Double(100,100,100,100); 
 g2.setColor(Color.yellow);
 g2.fill(x);  
 g2.setColor(Color.blue); 
  g2.setStroke(new BasicStroke(8.0f));
 g2.draw(x);
   g2.setStroke(new BasicStroke(2.0f));
 Ellipse2D x1=new Ellipse2D.Double(140,140,20,20); 
 g2.fill(x1);   
 for(int i=0;i<8;i++)
 { Line2D x2=line(15+7.5*i); g2.draw(x2); }
}
     public void run()
     {
        while(true)
        {
	    try {Thread.sleep(30);}
        catch(InterruptedException e)
        {System.err.println(e.toString());}
	    t++;
        repaint();
        }
    }

}


