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:
update:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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){ } } }
et la méthode de simulation:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 public void update(Graphics g){ simu.getLaGrille().update(zoneGauche.getGraphics()); }
où zoneGauche est mon Jpanel; quelqu'un a t-il une idée d'où pourrait provenir ce désagrément??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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()); } } }
D'avance merci
Partager