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