Browse Source

Changed Colors

feature_Minesweeper_Playfield
kfkama 3 years ago
parent
commit
7c6706bc20
  1. 14
      src/main/java/Minesweeper/Cell.java

14
src/main/java/Minesweeper/Cell.java

@ -16,6 +16,10 @@ enum CellType {
public class Cell extends JButton { 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 static final long serialVersionUID = 1L;
private Playfield playfield; private Playfield playfield;
@ -68,15 +72,15 @@ public class Cell extends JButton {
flagged = false; flagged = false;
if (type == CellType.Number) { if (type == CellType.Number) {
setBackground(Color.gray);
setBackground(HIDDENCOLOR);
playfield.cellDried(); playfield.cellDried();
} else { } else {
setBackground(Color.red);
setBackground(MINECOLOR);
} }
} else { } else {
flagged = true; flagged = true;
setBackground(Color.cyan);
setBackground(FLAGCOLOR);
if (type == CellType.Number) { if (type == CellType.Number) {
playfield.cellFlooded(); playfield.cellFlooded();
} }
@ -88,7 +92,7 @@ public class Cell extends JButton {
if (type == CellType.Number) { if (type == CellType.Number) {
setText(String.valueOf(value)); setText(String.valueOf(value));
} else { } else {
setBackground(Color.RED);
setBackground(MINECOLOR);
} }
} }
@ -97,7 +101,7 @@ public class Cell extends JButton {
return; return;
} }
setBackground(Color.LIGHT_GRAY);
setBackground(FLOODEDCOLOR);
setEnabled(false); setEnabled(false);
playfield.cellFlooded(); playfield.cellFlooded();

Loading…
Cancel
Save