//Titel:            Processing
//Version:       1,0
//Copyright:    Copyright (c) 2012
//Autor:          M. Wilhelm
//Organisation:
//Beschreibung:


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

public class Processing extends JFrame implements ActionListener {

private final int WIDTH=600;
private final int HEIGHT=600;

  JPanel  canvas = new JPanel();
  Timer myTimer;  
  int w=0;

  public Processing() {
     setSize(WIDTH, HEIGHT);
      setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
      setLayout( new BorderLayout());
      add(canvas, BorderLayout.CENTER);
      myTimer = new Timer(1000, this); // 200 ms
      myTimer.start();  // starten
  }

  public static void main(String[] args) {
    Processing frame = new Processing();
    frame.setVisible(true);
 }

  private void draw() {
    Graphics g = canvas.getGraphics() ;
    w+=10;
    if (w>getWidth()) w=10;
     g.drawRect((getWidth()>>1)-w, (getHeight()>>1)-w, w<<1,w<<1);
  }

      // wird vom Timer aufgerufen
  public void actionPerformed(ActionEvent e) {
     // canvas.update(canvas.getGraphics() );
    draw();
  }  // actionperformed



}  // Processing


