import java.awt.Graphics;


public class RectangleGraph extends Rectangle implements FormeGeometrique {
    Color c;
     public RectangleGraph(int x, int y, int l, int h, Color c)
     {
        super(x,y,l,h);
        this.c = c;
     }
     public void dessiner(Graphics g)
     {
         g.setColor(c);
         g.fillRect(x,y,l,h);
     }
     public boolean inside(int px, int py)
     {
         return (px-x>=0) && (px-x<=l) && (py-y>=0) && (py-y<=h);
     }
     public void dragX(int diffx)
     {
         x += diffx;
     }     
     public void dragY(int diffy)
     {
         y += diffy;
     }
     public boolean leavesX(int diffx, int sx)
     {
        return ((x+diffx<0) || (x+diffx+l>sx));
     }
     public boolean leavesY(int diffy, int sy)
     { 
        return ((y+diffy<0) || (y+diffy+h>sy));
     }
	@Override
	public void dessiner(Graphics g) {
		// TODO Auto-generated method stub
		
	}
}
