import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.swing.JPanel;

public class BarreJauge {

	int x,y;
	int info;
	Color couleur ;
	BufferedImage image ;
	int tailleOvale = 20 ;
	
	public BarreJauge(int x,int y, int info,Color couleur,String fichierImage){
		this.x=x;
		this.y=y;
		this.info=info;
		this.couleur=couleur;
		this.image=ImageLoader.scale(ImageLoader.ImgLoader(fichierImage),20+tailleOvale,20+tailleOvale);
	}

	public void dessine (Graphics g,JPanel jp){
		
		g.setColor(new Color(100,100,100));
		g.fillOval(x+2,y+2,26+tailleOvale,26+tailleOvale);
		
		g.drawImage(image,x+5,y+5,jp);
		
		g.setColor(new Color(20,20,20));
		g.drawOval(x,y,30+tailleOvale,30+tailleOvale);
		g.drawOval(x+1,y+1,28+tailleOvale,28+tailleOvale);
		g.drawOval(x+2,y+2,26+tailleOvale,26+tailleOvale);
		g.drawRoundRect(x+30+tailleOvale-5,y+(tailleOvale+30/2)-8,200,16,20,20);
		g.drawRoundRect(x+30+tailleOvale-4,y+(tailleOvale+30/2)-7,198,14,20,20);
		g.drawRoundRect(x+30+tailleOvale-3,y+(tailleOvale+30/2)-6,196,12,20,20);
		
		g.setColor(new Color(100,100,100));
		g.fillRoundRect(x+30+tailleOvale-3,y+(tailleOvale+30/2)-6,196,12,20,20);
		
		g.setColor(couleur);
		g.fillRoundRect(x+30+tailleOvale-3,y+(tailleOvale+30/2)-6,info/5-4,12,20,20);
		
	}
	
	public void actuInfo(int info){
		this.info=info;
	}
}
