@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		canvas.removeMouseListener(canvas.getDrawListener());
		canvas.removeMouseMotionListener(canvas.getDrawListener());

		switch (buttonNum) {
		case 1:
			listener = new PencilListener(canvas);
			break;
		case 2:
			listener = new LineListener(canvas);
			break;
		case 3:
			listener = new RectangleListener(canvas);
			break;
		case 4:
			listener = new OvalListener(canvas);
			break;
		case 5:
			listener = new FillRectangleListener(canvas);
			break;
		case 6:
			listener = new FillOvalListener(canvas);
			break;
		case 7:
			listener = new BucketFillListener(canvas);
		}

		canvas.setDrawListener(listener);
		canvas.addMouseMotionListener(listener);
		canvas.addMouseListener(listener);
	}