//
import java.awt.*;

public class Example2 extends BufferedApplet
{
   int width = 0, height = 0;
   int click = 0;

   public void render(Graphics g) {
      if (width == 0) {
         width  = bounds().width;
         height = bounds().height;
      }

      // DRAW A CLEAR WHITE BACKGROUND

      g.setColor(Color.white);
      g.fillRect(0, 0, width, height);

      // COMPUTE A CIRCULAR PATH x,y

      int x = (int)(width / 2 + width / 4 * Math.cos(0.1 * click));
      int y = (int)(height/ 2 - width / 4 * Math.sin(0.1 * click));

      // DRAW A SMALL DISK AT x,y

      g.setColor(Color.black);
      g.fillOval(x - 20, y - 20, 40, 40);

      // ADVANCE TIME

      click++;
      animating = true;
   }
}