public void actionPerformed(ActionEvent e) 
	{
		if(e.getSource() instanceof JTextField)
		{
			String data = inputField.getText();
			//Check whether input is double
			if (isDouble(data))
			{
				//Push parsed value onto doubleStack
				this.input = Double.parseDouble(data);
				this.doubleStack.push(input);
				
				//Push tree value onto tree
				LinkedBinaryTree<String> tree = new LinkedBinaryTree<String>();
				try {
					tree.addRoot(data);
				} catch (NonEmptyTreeException e1) {
					e1.printStackTrace();
				}
				this.treeStack.push(tree);
			}
			
			else
				JOptionPane.showMessageDialog(null, "Please enter only numbers.");
				
			inputField.setText("");
			repaint();
		}
		
		else if((e.getSource() instanceof JButton)
				&& doubleStack.size() >= 2)
		{
			JButton operatorButton = (JButton) e.getSource();
			String opName = operatorButton.getText();
			LinkedBinaryTree<String> newTree = new LinkedBinaryTree<String>();
			
			this.x = doubleStack.pop();
			this.y = doubleStack.pop();
			
			this.tree1 = treeStack.pop();
			this.tree2 = treeStack.pop();
			
			double arithmetic=0;
			
			if(opName.equals("+")) {
				arithmetic = x + y;
				newTree = join(newTree, "+", this.tree1, this.tree2);
			}
			
			else if(opName.equals("-")) {
				arithmetic = x - y;
				newTree = join(newTree, "-", this.tree1, this.tree2);
				}
			
			else if(opName.equals("*"))	{
				arithmetic = x * y;
				newTree = join(newTree, "*", this.tree1, this.tree2);
				}
			
			else if(opName.equals("/"))	{
				arithmetic = x / y;
				newTree = join(newTree, "/", this.tree1, this.tree2);
				}
			
			//Push new value and new tree onto corresponding stacks
			doubleStack.push(arithmetic);
			treeStack.push(newTree);			
			
			repaint();
		}
		
	}