package canvas;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;

import javax.swing.JPanel;
import javax.swing.border.*;
import com.borland.jbcl.layout.*;

public class DrawArea extends JPanel {
  Shape[] theShapes = new Shape[10];
  int count = 0;
  private Border border1;
  private XYLayout xYLayout1 = new XYLayout();

  public DrawArea() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    } }

  public void paint( Graphics g){
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    for (int i=0 ; i < count; i++ )
      g2d.draw(theShapes[i]);
  }

  public void add(Shape aShape){
    theShapes[count] = aShape;
    count++;
    this.repaint();
  }
  private void jbInit() throws Exception {

    this.setEnabled(true);
    this.setLayout(xYLayout1);
  }

}
