package personnages; /** Modelise un personnage qui marche de long en large */ public class Penseur extends Bonhomme { public Penseur() { super(); } public void run() { while (!estStoppe()) { synchronized(this) { try { while (estSuspendu()) wait(); } catch(InterruptedException exc) {} } if (estStoppe()) break; fairePas(); if (((getDirection() == Personnage.DROITE) && (getX() > 4*zone.getBounds().width / 5)) || ((getDirection() == Personnage.GAUCHE) && (getX() < zone.getBounds().width/5))) changerDirection(); yield(); dormir(); } } }