Carré gris au milieu du JPanel
Bonsoir!!! Je vous demande de l'aide pour un petit problème d'affichage; Je simule dans un JPanel un décor et un avion; à la fin de la simulation (elle se fait cycle après cycle), apparaît un étrange rectangle gris au milieu!! voici mes méthodes:
paintComponent:
Code:
1 2 3 4 5 6 7 8 9 10 11
|
protected void paintComponent(Graphics g){
if(zoneGauche!=null){
try{
super.paint(g);
simu.getLaGrille().paint(zoneGauche.getGraphics());
}
catch(NullPointerException npe){ }
}
} |
update:
Code:
1 2 3 4
|
public void update(Graphics g){
simu.getLaGrille().update(zoneGauche.getGraphics());
} |
et la méthode de simulation:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
public void simuCompleteGraphique (int nbCycle, SimulationGraphique simu){
if (nbCycle==0){
System.out.println("Pas de simulation");
this.repaint();
}
else{
this.paintComponent(zoneGauche.getGraphics());
for (int i=1; i<=nbCycle; i++){
simu.getSimu().uncycle();
temporisation();
this.update(zoneGauche.getGraphics());
}
}
} |
où zoneGauche est mon Jpanel; quelqu'un a t-il une idée d'où pourrait provenir ce désagrément??
D'avance merci