import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Fond extends JPanel implements ActionListener {

	int etat = 0;

	public Fond()
	{
		super();
		JButton bouton = new JButton("Blue");
		this.add(bouton);
		JButton bouton2 = new JButton("Red");
		this.add(bouton2);
		JButton bouton3 = new JButton("Green");
		this.add(bouton3);

		bouton.addActionListener(this);
		bouton2.addActionListener(this);
		bouton3.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e) 
	{
		
       	if (e.getActionCommand()=="Blue") {
       		this.setBackground(Color.BLUE);
			this.etat = 1;
       	}
       	if (e.getActionCommand()=="Red") {
       		this.setBackground(Color.RED);
			this.etat = 2;
       	}
       	if (e.getActionCommand()=="Green") {
       		this.setBackground(Color.GREEN);
			this.etat = 3;
       	}
    }
}