private void buttonComputeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonComputeActionPerformed

        String errorMessage = "";
        boolean error = true;

        try
        {
            loanCalculate.setMonthlyInterest(Float.parseFloat(textInterest.getText()));
        }
        catch(Exception e)
        {
            error = false;
        }
        try{
            loanCalculate.setPrincipalBalance(Float.parseFloat(textPrincipal.getText()));
        }
        catch(Exception r)
        {
            error = false;
        }
        
        loanCalculate.setTotalNumberOfPayment(1);


        Date grantdt = new Date();
        currentDate = grantdt;

        if(error)
        {
            principal = Float.parseFloat(textPrincipal.getText());
            interest = loanCalculate.getInterest();
            interestrt = Float.parseFloat(textInterest.getText());
            totalPayment = loanCalculate.getCashloan();
            totInterest = totalPayment - principal;
            labelTotalPayment.setText(Float.toString(totalPayment));
            labelTotalInterest.setText(Float.toString(totInterest));
            labelTotalPrincipal.setText(Float.toString(principal));
            checkNo = textCheckNo.getText();
            currentdtString = df.format(currentDate);

            if(textEndDate.getText().length() != 0)
            {
                String dateToFormatEnd = textEndDate.getText();
                try
                {
                    enddt = df.parse(dateToFormatEnd);
                    finalEndString = df.format(enddt);
                }
                catch (ParseException ex)
                {
                    Logger.getLogger(AddCashloan.class.getName()).log(Level.SEVERE, null, ex);
                }
            }

            buttonConfirm.setEnabled(true);
            buttonCompute.setEnabled(false);
        }
    }//GEN-LAST:event_buttonComputeActionPerformed