// M.Martin 19.9.04

import java.awt.*;
import java.awt.event.*;
import java.text.*;

public class Rechne1 extends java.applet.Applet implements ActionListener
{ int zahl;

  Button erhTaste;
  Button rechneTaste;
  Button ernTaste;
  Label zahlLabel;
  Label quadratLabel;

  public void init()
  { erhTaste = new Button("Zahl erhöhen");
    rechneTaste = new Button("Rechnen");
    ernTaste = new Button("Zahl erniedrigen");
                                               
    zahlLabel = new Label("Zahl: 0");
    quadratLabel = new Label("Quadrat: 0");

    setLayout(null);
    erhTaste.setBounds(10,30,100,30); //x,y breite,höhe
    ernTaste.setBounds(10,70,100,30); //x,y breite,höhe
    rechneTaste.setBounds(10,110,100,30); //x,y breite,höhe
    zahlLabel.setBounds(10,160,100,30); //x,y breite,höhe
    quadratLabel.setBounds(10,200,100,30); //x,y breite,höhe

    
    add(erhTaste);
    add(zahlLabel);
    add(ernTaste);
    add(quadratLabel);
    add(rechneTaste);

    
    erhTaste.addActionListener(this);
    ernTaste.addActionListener(this);
    rechneTaste.addActionListener(this);
     
  } // init

   public void actionPerformed(ActionEvent e)
   { if (e.getSource()==erhTaste)
       { zahl++;
         zahlLabel.setText("Zahl: "+zahl);
       }
     if (e.getSource()==ernTaste)
       {  zahl--;
          zahlLabel.setText("Zahl: "+zahl);
       }
     if (e.getSource()==rechneTaste)
       {
          quadratLabel.setText("Quadrat: "+zahl*zahl);
       }

   }
}


