package InterfGraph;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JPanel;

public class ColorPanel extends JPanel
{
	
	private int rouge = 0,
			vert = 0,
			bleu = 0;
	
	public ColorPanel()
	{
		super();
		//this.setPreferredSize(new Dimension(300, 300));
	}
	
	public void setRouge(int pForce)
	{
		if (pForce >=0 && pForce <= 255)
		{
			this.rouge = pForce;
			//System.out.println("ColorPanel SetRouge");
			this.repaint();
		}
	}

	public void setVert(int pForce)
	{
		if (pForce >=0 && pForce <= 255)
		{
			this.vert = pForce;
			this.repaint();
		}
	}

	public void setBleu(int pForce)
	{
		if (pForce >=0 && pForce <= 255)
		{
			this.bleu = pForce;
			this.repaint();
		}
	}
	
	public void paint(Graphics g)
	{
		Color maCouleur = new Color(this.rouge, this.vert, this.bleu);
		g.setColor(maCouleur);
		g.fillOval(10, 10, 100, 100);
		//System.out.println("Paint est appelé");
	}
}
