@Override
			public void mousePressed(MouseEvent arg0) {

				if (rectangle.isSelected() || oval.isSelected()
						|| line.isSelected() || image.isSelected()) {

					if (!isDrawing) {
						pivotX = arg0.getX();
						pivotY = arg0.getY();
					} else {
						if (rectangle.isSelected()) {
							shapes.add(new Rectangle(upperX, upperY,
									colorChooser.getColor(), width, height));
						} 
						
						else if (oval.isSelected()) {
							shapes.add(new Oval(upperX, upperY, colorChooser
									.getColor(), width, height));
						} 
						
						else if (line.isSelected()) {
							shapes.add(new Line(pivotX, pivotY, newX, newY,
									colorChooser.getColor()));
						}
						
						else if (image.isSelected()){
							shapes.add(new Image(upperX, upperY, width, height, doge));
						}
					}

					isDrawing = !isDrawing;
				}

				repaint();
			}