import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Fond implements ActionListener{ private JPanel panneau; private String couleur; String s2="CYAN"; String s3="PINK"; String s4="YELLOW"; public Fond(JPanel panneau2){ this.panneau = panneau2; } public void actionPerformed(ActionEvent e){ couleur = e.getActionCommand(); System.out.println(couleur); if(couleur.equals(s2)){ panneau.setBackground(Color.CYAN); System.out.println("1"); } if(couleur.equals(s3)){ panneau.setBackground(Color.PINK); System.out.println("2"); } if(couleur.equals(s4)){ panneau.setBackground(Color.YELLOW); System.out.println("3"); } } }