// 円軌道を運動するボールの軌跡
import java.applet.* ;
import java.awt.* ;

public class sample07 extends Applet implements Runnable {
  int t = 0 ;           // 角度 (deg.)
  double hankei = 150 ; // 軌道の半径
  Thread th = null ;

  public void start() {
    th = new Thread(this) ;
    th.start() ;
  }

  public void run() {
    while( th != null ) {
      repaint() ;
      t = (t+5)%360 ;
      try {
        th.sleep(10) ; // 10ms = 0.01秒停止
      }
      catch (InterruptedException e) {
      }
    }
  }
  
  public void paint(Graphics g) {
    double a ;
    int x, y ;
    g.setColor(Color.white) ;
    g.fillRect(10,10,380,380) ;
    a = (double)t*Math.PI/180.0 ;
    x = (int)( hankei * Math.cos(a) ) ;
    y = (int)( hankei * Math.sin(a) ) ;
    g.setColor(Color.blue) ;
    g.fillOval( x+200-10, -y+200-10, 21, 21 ) ;
  }
}