import java.awt.*;
import javax.swing.*;

import java.awt.event.*;

public class Line06 extends JFrame {


  public Line06(String caption) {
    setLayout ( new BorderLayout() );
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setTitle(caption);
    this.getContentPane().add( new CCanvas(), 
       BorderLayout.CENTER );
  }



    public static void main(String args[]) {
      Line06 f = new Line06("6. Linie");
     	f.setSize(700,500);
    	f.setVisible(true);
    }


}



class CCanvas extends Canvas {

   double f(double x) {
    	return ( Math.sin(x/7)*Math.exp(-x*0.005) + 2) 
       * getSize().height / 4;
   }



  public void paint (Graphics g)
  {
     Color c;
     Font f;
     for (int x = 0 ; x < getSize().width ; x++) {
       g.drawLine(x, (int)f(x), x + 1, (int)f(x + 1));
      c = g.getColor();
      f = g.getFont();
     }
  }

}

