From 7c6706bc2021cf331232402e90e61a829cad8477 Mon Sep 17 00:00:00 2001 From: kfkama Date: Thu, 17 Feb 2022 18:59:03 +0100 Subject: [PATCH] Changed Colors --- src/main/java/Minesweeper/Cell.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/Minesweeper/Cell.java b/src/main/java/Minesweeper/Cell.java index 31c0e7b..2252b7d 100644 --- a/src/main/java/Minesweeper/Cell.java +++ b/src/main/java/Minesweeper/Cell.java @@ -16,6 +16,10 @@ enum CellType { public class Cell extends JButton { + private static final Color FLAGCOLOR = Color.RED; + private static final Color FLOODEDCOLOR = Color.LIGHT_GRAY; + private static final Color HIDDENCOLOR = Color.GRAY; + private static final Color MINECOLOR = Color.BLACK; private static final long serialVersionUID = 1L; private Playfield playfield; @@ -68,15 +72,15 @@ public class Cell extends JButton { flagged = false; if (type == CellType.Number) { - setBackground(Color.gray); + setBackground(HIDDENCOLOR); playfield.cellDried(); } else { - setBackground(Color.red); + setBackground(MINECOLOR); } } else { flagged = true; - setBackground(Color.cyan); + setBackground(FLAGCOLOR); if (type == CellType.Number) { playfield.cellFlooded(); } @@ -88,7 +92,7 @@ public class Cell extends JButton { if (type == CellType.Number) { setText(String.valueOf(value)); } else { - setBackground(Color.RED); + setBackground(MINECOLOR); } } @@ -97,7 +101,7 @@ public class Cell extends JButton { return; } - setBackground(Color.LIGHT_GRAY); + setBackground(FLOODEDCOLOR); setEnabled(false); playfield.cellFlooded();