6 Replies Latest reply: Oct 26, 2006 11:23 AM by 807607 RSS

    Adding doubles problem

    807607
      Hi, I just got a small problem. I am trying to retrieve a number from a text field. and add 0.20 to it every time I click on a button. This is the code I have for the button:

      if (event.getSource() == twentycButton)
      {
      String pf = paymentField.getText();
      pf = pf + 0.20;
      double pfd1 = Double.parseDouble(pf);
      String pfs1 = Double.toString(pfd1);
      paymentField.setText(pfs1);
      }

      I get no compiling errors, but however I get a runtime error when I click on the button telling me about multiple point exceptions. Anyone know what I am doing wrong?

      Thanks