@Override
	public void paint(Graphics g){
		g.setColor(p.getBgcolor());
		g.fillRect(0, 0, getWidth(), getHeight());
		for(Iterator<Drawable> it = p.getDrawables().iterator(); it.hasNext();){
			this.paintDrawable(it.next(), g);
		}
		if(p.getWorkingLayer() >= 0 && p.getCurrentTool() == -1){
			Drawable figure = p.getDrawables().get(p.getWorkingLayer());
			g.setColor(Color.BLUE);
			if(figure.getShapeType() != Drawable.LINE){ 
				g.drawRect(figure.getOriginX(), figure.getOriginY(), figure.getWidth(), figure.getHeight());
				g.drawRect(figure.getOriginX()-5, figure.getOriginY()-5, 10, 10);
				g.drawRect(figure.getOriginX()-5, figure.getOriginY() + figure.getHeight()-5, 10, 10);
				g.drawRect(figure.getOriginX()+figure.getWidth()-5, figure.getOriginY()+ figure.getHeight()-5, 10, 10);
				g.drawRect(figure.getOriginX() + figure.getWidth()-5, figure.getOriginY()-5, 10, 10);
			}else{
				g.drawRect(figure.getOriginX()-5, figure.getOriginY()-5, 10, 10);
				g.drawRect(figure.getOriginX()+figure.getWidth()-5, figure.getOriginY()+ figure.getHeight()-5, 10, 10);
			}
		}
	}