1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
public class Interface extends JFrame implements KeyListener,ActionListener,MouseMotionListener,Runnable{
public Thread vie;
[...]
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
/*
* Action sur le bouton pour faire vivre la population
*/
if(o==boutonVie){
vie=new Thread();
vie.start();
vie.run();
}
}//fin du action performed
public void run(){
try{
while(grille.nbAmibe!=1){
info.append(grille.vivre());
affichageInfo();
Thread.sleep(3000);
}
} catch (InterruptedException IE) {}
}
}//fin de classe |
Partager