From 39b43c045470527648c9c2568fac17b98251e83a Mon Sep 17 00:00:00 2001 From: Justine Yannis Date: Thu, 13 Oct 2022 13:46:51 +0200 Subject: [PATCH] =?UTF-8?q?Listener=20mais=20faudrait=20cr=C3=A9er=20notre?= =?UTF-8?q?=20listener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java | 3 ++- projetAgile/src/fr/iutfbleau/projetAgile/View/Pion.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java b/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java index 65e8704..1471fa8 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java @@ -66,7 +66,8 @@ public class Grille extends JPanel implements Observer{ protected void addPlayerPawn(int column, int row, int player) { Color c = player == Constants.PLAYER_ONE ? Constants.PLAYER_ONE_COLOR : Constants.PLAYER_TWO_COLOR; - this.grille[column][row] = new Pion(player); + this.grille[column][row].setPlayer(player); + this.grille[column][row].repaint(); } } \ No newline at end of file diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/View/Pion.java b/projetAgile/src/fr/iutfbleau/projetAgile/View/Pion.java index d8ee795..8814ea4 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/View/Pion.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/View/Pion.java @@ -27,6 +27,10 @@ public class Pion extends JComponent{ this.player = player; } + public void setPlayer(int player) { + this.player = player; + } + @Override protected void paintComponent(Graphics g) { Graphics g2 = g.create();