private void btnValidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnValidateActionPerformed
    String expression = JOptionPane.showInputDialog(this, "Write an expression to validate.", 
            "Input Expression", JOptionPane.INFORMATION_MESSAGE);
    
    if(expression == null || expression.isEmpty())
        return;
    
    boolean isValid = false;
        try {
            isValid = AFManager.validateExpression(expression);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    
    if(isValid)
        JOptionPane.showMessageDialog(this, "The expression: [" + expression + "] is valid.", 
                "Valid expression", JOptionPane.INFORMATION_MESSAGE);
    else
        JOptionPane.showMessageDialog(this, "The expression: [" + expression + "] is invalid.\nDetail: " + AFManager.getErrorMessage(), 
                "Invalid expression", JOptionPane.ERROR_MESSAGE);
}//GEN-LAST:event_btnValidateActionPerformed