Created
May 26, 2016 14:51
-
-
Save anymaniax/cc52014482297b20e15f367cdb03d3f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CouleurAction implements ActionListener{ | |
private JLabel lblCouleur ; | |
private JPanel pnlPanneau ; | |
public CouleurAction(JLabel lblCouleur ,JPanel pnlPanneau){ | |
this.lblCouleur=lblCouleur ; | |
this.pnlPanneau=pnlPanneau ; | |
} | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
JButton btnSource=(JButton)e.getSource(); | |
lblCouleur.setText( btnSource.getText() ) ; | |
if(btnSource.getActionCommand( ) == "Rouge" ) { | |
pnlPanneau.setBackground ( Color.RED) ; | |
} | |
else{ | |
pnlPanneau.setBackground ( Color.GREEN) ; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment