update color
This commit is contained in:
@@ -57,7 +57,7 @@ public class Window extends JFrame implements OutputSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Color getCellColor(int x, int y) {
|
private Color getCellColor(int x, int y) {
|
||||||
return ((x + y) % 2 == 1) ? Color.BLACK : Color.WHITE;
|
return ((x + y) % 2 == 1) ? Color.DARK_GRAY : Color.LIGHT_GRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildButtons(JPanel bottom) {
|
private void buildButtons(JPanel bottom) {
|
||||||
@@ -197,7 +197,7 @@ public class Window extends JFrame implements OutputSystem {
|
|||||||
}
|
}
|
||||||
if (!this.lastClick.equals(new Coordinate(x, y))) {
|
if (!this.lastClick.equals(new Coordinate(x, y))) {
|
||||||
Move move = new Move(lastClick, new Coordinate(x, y));
|
Move move = new Move(lastClick, new Coordinate(x, y));
|
||||||
|
|
||||||
if (sendCommand(new MoveCommand(move)) == CommandResult.NotAllowed) {
|
if (sendCommand(new MoveCommand(move)) == CommandResult.NotAllowed) {
|
||||||
drawInvalid(move);
|
drawInvalid(move);
|
||||||
}
|
}
|
||||||
@@ -207,13 +207,13 @@ public class Window extends JFrame implements OutputSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerTurn(chess.model.Color color) {
|
public void playerTurn(chess.model.Color color) {
|
||||||
this.displayText.setText("C'est au tour de " + color);
|
this.displayText.setText("Current turn: " + color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void winnerIs(chess.model.Color color) {
|
public void winnerIs(chess.model.Color color) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
JOptionPane.showMessageDialog(this, "Victoire de " + color);
|
JOptionPane.showMessageDialog(this, "Victory of " + color);
|
||||||
this.dispose();
|
this.dispose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -221,28 +221,28 @@ public class Window extends JFrame implements OutputSystem {
|
|||||||
@Override
|
@Override
|
||||||
public void kingIsInCheck() {
|
public void kingIsInCheck() {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
JOptionPane.showMessageDialog(this, "Échec !");
|
JOptionPane.showMessageDialog(this, "Check!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void kingIsInMat() {
|
public void kingIsInMat() {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
JOptionPane.showMessageDialog(this, "Échec et mat !");
|
JOptionPane.showMessageDialog(this, "Checkmate!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void patSituation() {
|
public void patSituation() {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
JOptionPane.showMessageDialog(this, "Pat. Égalité !");
|
JOptionPane.showMessageDialog(this, "Pat. It's a draw!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hasSurrendered(chess.model.Color color) {
|
public void hasSurrendered(chess.model.Color color) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
JOptionPane.showMessageDialog(this, "Abandon de " + color);
|
JOptionPane.showMessageDialog(this, color + " has surrendered.");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user