import java.awt.*;
import java.awt.event.*;

/**
  *
  * Beschreibung
  *
  * @version 1.0 vom 23.06.2014
  * @author 
  */

public class GuiDrawTest extends Frame {
  // Anfang Attribute
  private Button bt_draw = new Button();
  private DrawCanvas dc_test = new DrawCanvas(); 
  private Button bt_start = new Button();
  // Ende Attribute
  
  public GuiDrawTest(String title) { 
    // Frame-Initialisierung
    super(title);
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent evt) { dispose(); }
    });
    int frameWidth = 200; 
    int frameHeight = 300;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2;
    setLocation(x, y);
    setResizable(false);
    Panel cp = new Panel(null);
    add(cp);
    // Anfang Komponenten
    
    dc_test.setBounds(30, 40, 130, 160);
    dc_test.setBackground(Color.YELLOW);
    cp.add(dc_test);
    bt_draw.setBounds(104, 224, 65, 25);
    bt_draw.setLabel("Zeichne");
    bt_draw.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent evt) { 
        bt_draw_ActionPerformed(evt);
      }
    });
    cp.add(bt_draw);
    bt_start.setBounds(8, 224, 65, 25);
    bt_start.setLabel("Start");
    bt_start.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent evt) { 
        bt_start_ActionPerformed(evt);
      }
    });
    cp.add(bt_start);
    // Ende Komponenten
    
    setVisible(true);
  } // end of public GuiDrawTest
  
  // Anfang Methoden
  public void bt_draw_ActionPerformed(ActionEvent evt) {
    // TODO hier Quelltext einfügen
    this.dc_test.incStep ();
    this.dc_test.repaint();
  } // end of bt_draw_ActionPerformed
  
  public void bt_start_ActionPerformed(ActionEvent evt) {
    // TODO hier Quelltext einfügen
    this.dc_test.setStep (0);
    this.dc_test.repaint();
  } // end of bt_start_ActionPerformed
  
  // Ende Methoden
  
  public static void main(String[] args) {
    new GuiDrawTest("GuiDrawTest");
  } // end of main
  
} // end of class GuiDrawTest
