// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.*;
import java.awt.*;
import java.awt.event.*;

public class Sinus extends Frame {
   Vector points;
   public Sinus() {
      points = new Vector();
      int w = 400;
      int h = 300;
      setSize(w, h);
      for (int x = 0; x < w; x++) {
         int y = (int)(0.5 * h + 0.4 * h * Math.sin(x * 5 * Math.PI / w));
         points.addElement(new Point(x, y));
      }
      setVisible(true);
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      }); 
   }
   public void paint(Graphics g) {
      for (int i = 0; i < points.size(); i++) {
         Point p = (Point) points.elementAt(i);
         g.drawRect(p.x, p.y, 2, 2);
      }
   }
   public static void main(String[] args) {
      new Sinus();
   }
}
