@Override
	public void actionPerformed(ActionEvent e) {
		int size = 1;
		boolean flag = false;
		if(e.getSource() == brush){
			canvas.set_selectedOption(DrawType.BRUSH);
			sizeSlider.setMaximum(30);
			size = 10;
			flag = true;
			((JButton)e.getSource()).setBackground(Color.BLACK);
		}
		if(e.getSource() == pen){
			canvas.set_selectedOption(DrawType.PEN);
			sizeSlider.setMaximum(10);
			size = 1;
			flag = true;
		}
		if(e.getSource() == erase) {
			canvas.set_selectedOption(DrawType.ERASE);
			sizeSlider.setMaximum(40);
			size = 30;
			flag = true;
		}
		if(flag) { // If one of the above
			//Generic to all
			canvas.set_brushSize(size);
			sizeSlider.setVisible(false);
			brushSize.setVisible(true);
			sizeSlider.setValue(size);
			//Set all to 'off'
			pen.setOpaque(false);
			pen.repaint();
			brush.setOpaque(false);
			brush.repaint();
			erase.setOpaque(false);
			erase.repaint();
			//Set selected to 'on'
			((JButton)e.getSource()).setOpaque(true);
			((JButton)e.getSource()).setBackground(Color.darkGray);
			//If clear, just turn to 'off'
			clear.setOpaque(false);
			clear.repaint();
		}
		
		if(e.getSource() == clear){
			canvas.clear(); //clear canvas, does not change reference
		}

		if(e.getSource() == brushSize){
			brushSize.setVisible(false);
			sizeSlider.setVisible(true);
		}
		if(e.getSource() == brushColour) {
			if(firstRun) {
				cp.createAndShowGUI();
				firstRun = false;
			}
			cp.setVisible(masterFrame.getX(),masterFrame.getY(), false);
		}
		canvas.redrawAction();

	}