@Override
	public void actionPerformed(ActionEvent a) {
		if (a.getSource() == btnCalculate) {
			String exp = this.txtExpression.getText();
			String x = this.txtX.getText();

			if (!exp.isEmpty() && !x.isEmpty()) {
				String result;

				if(!exp.equals(prevExpression)){
					parser.setExpression(exp);
					prevExpression = exp;
				}
				try{
					result = new DecimalFormat("#0.00").format(parser.eval(Double.parseDouble(x)));
					this.txtY.setText(result);
				} catch(IllegalArgumentException e){
					this.txtY.setText("Undefined");
				}
			}
		} else {
			if (this.cmbTrig.getSelectedIndex() == 0)
				this.parser.setIsRadian(false);
			if (this.cmbTrig.getSelectedIndex() == 1)
				this.parser.setIsRadian(true);
		}
	}