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

        //Variables must contain only letters and digits.
        for (char c : txtVarName.getText().toCharArray()) {
            if (!Character.isLetterOrDigit(c)) {
                return;
            }
        }

        //Vector to add to the table.
        Vector temp = new Vector<>();
        //Name of the variable
        String varName = txtVarName.getText();
        //Value of the variable
        double varValue;
        try {
            varValue = Double.parseDouble((new Solver(txtVarValue.getText(), varData)).solve());
        } catch (NumberFormatException e) {
            return;
        }

        //Variable name must be unique.
        if (varData.keySet().contains(varName)) {
            return;
        }

        //Add Name Value to the temp vector.
        temp.add(varName);
        temp.add(varValue);

        //Add to variable TreeMap
        varData.put(varName, varValue);

        ((DefaultTableModel) tableVars.getModel()).addRow(temp);
    }//GEN-LAST:event_btnAddVActionPerformed