title: adding numbers in textfield with add button java
body: <p>I am trying to write a <code>textfield</code> and a button using applet. The main problem is that I cannot seem to figure out how to add multiple numbers such as one number then hit the add button then the number then add button and display the total as well in the same textfield like the basic calculator program. Here is what I've got so far:</p>
  
  <pre><code>import java.applet.Applet;
  import java.awt.Button;
  import java.awt.TextField;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  
  public class addition extends Applet implements ActionListener {
      TextField tf;
      Button btnAdd;
      Button btnEqual;
      Button btnExit;
  
      public addition() {
          tf = new TextField(15);
          btnAdd = new Button(" + ");
          btnEqual = new Button(" = ");
          btnExit = new Button("exit");
      }
  
      public void init() {
          add(tf);
          add(btnAdd);
          add(btnEqual);
          add(btnExit);
      }
  
      @Override
      public void actionPerformed(ActionEvent e) {
          if (e.getSource() == btnAdd.getFocusListeners()) {
              tf.setText("text goes here");
          }
      }
  }
  </code></pre>