29 lines
727 B
Java
29 lines
727 B
Java
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
public class FondEvent implements ActionListener{
|
|
public JPanel panneau;
|
|
|
|
public FondEvent(JButton[] boutons){
|
|
panneau = new JPanel();
|
|
for (JButton bouton : boutons){
|
|
panneau.add(bouton);
|
|
}
|
|
boutonContainer.setBackground(new Color(46,209,111));
|
|
}
|
|
|
|
public void fenetre(){
|
|
JFrame fenetre = new JFrame();
|
|
fenetre.setSize(500, 300);
|
|
fenetre.setLocation(0, 0);
|
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
fenetre.add(boutonContainer, BorderLayout.CENTER);
|
|
fenetre.setVisible(true);
|
|
}
|
|
@Overrides
|
|
void actionPerformed(ActionEvent evenement){
|
|
String couleur = this.getActionCommand();
|
|
boutonContainer.setBackground(couleur);
|
|
}
|
|
}
|