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


public class Line01 extends JFrame {

  public Line01() {
    setLayout( new BorderLayout());
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setTitle("1. bbBeispiel");
    this.getContentPane().add(new CCanvas(), BorderLayout.CENTER );
  }




    public static void main(String args[]) {
      Line01 f = new Line01();
      f.setTitle("Line 01. Beispiel");
      f.setSize(300,200);
    	f.setVisible(true);
    }


}



class CCanvas extends JPanel {
  int i=0;

  public void paint (Graphics g)
  {
    int width,height;
    width = this.getWidth();
    height = this.getHeight();
    g.drawLine(10,10,width-10,height-10);

      g.drawLine(10,40,10,100);
      g.drawLine(10,100,30,300);
      g.drawLine(30,300,300,50);
    System.out.println("draw"+(++i));

  }
  
}


/*
    int x = 80;
    for (int i=0; i<60; i++) {
      g.drawLine(x,40,x,100);
      x += 1+ 10*Math.random();
    }
    System.out.println("paint-montag");
*/