From b51cfb67323aa4f1441ec2f4b4a255a72a340753 Mon Sep 17 00:00:00 2001 From: kfkama Date: Thu, 17 Feb 2022 14:48:48 +0100 Subject: [PATCH] Change update for celltype bomb --- src/main/java/Minesweeper/Cell.java | 2 ++ src/main/java/Minesweeper/Playfield.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/Minesweeper/Cell.java b/src/main/java/Minesweeper/Cell.java index c2a3f33..7b5e0de 100644 --- a/src/main/java/Minesweeper/Cell.java +++ b/src/main/java/Minesweeper/Cell.java @@ -43,6 +43,8 @@ public class Cell extends JButton { public void update() { if (type == CellType.Number) { setText(String.valueOf(value)); + } else { + setBackground(Color.RED); } } diff --git a/src/main/java/Minesweeper/Playfield.java b/src/main/java/Minesweeper/Playfield.java index 1cefcbf..14f0a81 100644 --- a/src/main/java/Minesweeper/Playfield.java +++ b/src/main/java/Minesweeper/Playfield.java @@ -38,6 +38,7 @@ public class Playfield { for (int k = 0; k < bPlacement.length; k++) { if (bPlacement[k] == i * Size + j) { cells[i][j].type = CellType.Bomb; + cells[i][j].update(); break; } }