Created
April 15, 2016 07:24
-
-
Save TimDorand/e562a184c69f9e190744667725738104 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
private void melangeLesCartes() | |
{ | |
for (int i = 0 ; i < nbCartes ; i++ ){ | |
// On met un valeur aléatoire dans v | |
int v = (int) (Math.random() * nbCartes); | |
// On stocke la valeur alea dans une valeur temporaire | |
Carte temp = listeCartes[i]; | |
// on met le hasard temp dans la vrai case | |
listeCartes[i] = listeCartes[v]; | |
listeCartes[v] = temp; | |
} | |
} | |
private void afficherLesCartesAvecEvt() | |
{ | |
for (int i=0; i< nbCartes; i++) | |
{ | |
this.boitePhotoPnl.add(listeCartes[i]); | |
listeCartes[i].addMouseListener(new MouseAdapter(){ | |
@Override | |
public void mouseReleased(MouseEvent evt){ | |
carteMouseReleased(evt); | |
} | |
}); | |
} | |
} | |
private void carteMouseReleased(MouseEvent evt) | |
{ | |
Carte carteCliquee = (Carte) evt.getSource(); | |
carteCliquee.tournerVersFace(); | |
System.out.println("id : "+carteCliquee.getId()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment