BUT2/DEV/DEV2.1/TP08_Evenement/Q3_Radio/FondEvent.java

26 lines
559 B
Java
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class FondEvent implements ActionListener{
public JPanel panneau;
public FondEvent(JPanel contenu){
this.panneau = contenu;
}
@Override
public void actionPerformed(ActionEvent evenement){
String couleur = evenement.getActionCommand();
if (couleur=="Cyan"){
panneau.setBackground(Color.CYAN);
}
if (couleur=="Magenta"){
panneau.setBackground(Color.MAGENTA);
}
if (couleur=="Jaune"){
panneau.setBackground(Color.YELLOW);
}
}
}