Listener mais faudrait créer notre listener

This commit is contained in:
Justine Yannis 2022-10-13 13:46:51 +02:00
parent 521be6a04a
commit 39b43c0454
2 changed files with 6 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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();