35 lines
673 B
Java
35 lines
673 B
Java
|
import java.awt.*;
|
||
|
import javax.swing.*;
|
||
|
import java.awt.event.*;
|
||
|
|
||
|
public class ObservateurRadio implements ActionListener
|
||
|
{
|
||
|
private JPanel panneau;
|
||
|
|
||
|
public ObservateurRadio(JPanel panneau)
|
||
|
{
|
||
|
this.panneau = panneau;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e)
|
||
|
{
|
||
|
String action = e.getActionCommand();
|
||
|
|
||
|
if (action == "CYAN")
|
||
|
{
|
||
|
panneau.setBackground(Color.CYAN);
|
||
|
}
|
||
|
|
||
|
else if (action == "MAGENTA")
|
||
|
{
|
||
|
panneau.setBackground(Color.MAGENTA);
|
||
|
}
|
||
|
|
||
|
else if (action == "YELLOW")
|
||
|
{
|
||
|
panneau.setBackground(Color.YELLOW);
|
||
|
}
|
||
|
}
|
||
|
}
|