import java.awt.*;
import java.applet.*;

public class SomeText extends Applet {

   Label
       l1 = new Label("Cena ");
   Button

       b1 = new Button("Kupuj"),
       b2 = new Button("Celkom"),
       b3 = new Button("Novy Zakaznik");

   TextField

       t1 = new TextField("Cena",15),
       t2 = new TextField("Celkom",15);
   TextArea

       t3 = new TextArea("!Kommentar!",10,50);

   String s = new String();
   float suma = 0.0f;

   public void init() {
       add(l1);
       add(t1);
       add(b1);
       add(t2);
       add(b2);
       add(b3);
       add(t3);
   }

   public float pridaj(float f) {
      suma = suma + f;
      return (suma);
   }
   public boolean action(Event evt, Object arg) {

     if (evt.target.equals(b1)) {
         t1.setEditable(true);
         s = t1.getText();
         Float f = new Float(s);
         pridaj(f.floatValue());
     }
     else if (evt.target.equals(b2)) {
        t2.setText("Celkom: "+ pridaj(0.0f));
        t2.setEditable(false);
        t3.setText(" ");
     }
     else if (evt.target.equals(b3)) {
        t1.setText("");
        t2.setText("");
        t3.setText("");
        t3.setText("  Toto je novy zakaznik! " + "\n");
        t3.appendText("  Zadaj cenu tovaru!" + "\n");

        suma = 0.0f;
        s = t1.getText();
     }
     else
       return super.action(evt,arg);

     return true;
   }
}