Browse Source

Bugfix worng colors on unflag

feature_Minesweeper_Playfield
kfkama 3 years ago
parent
commit
896413211c
  1. 8
      src/main/java/Minesweeper/Cell.java

8
src/main/java/Minesweeper/Cell.java

@ -18,7 +18,7 @@ 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 HIDDENCOLOR = Color.WHITE;
private static final Color MINECOLOR = Color.BLACK;
private static final long serialVersionUID = 1L;
private Playfield playfield;
@ -33,7 +33,7 @@ public class Cell extends JButton {
cord = _cord;
playfield = _playfield;
setBackground(Color.white);
setBackground(HIDDENCOLOR);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -72,11 +72,9 @@ public class Cell extends JButton {
if (flagged) {
flagged = false;
setBackground(HIDDENCOLOR);
if (type == CellType.Number) {
setBackground(HIDDENCOLOR);
playfield.cellDried();
} else {
setBackground(MINECOLOR);
}
} else {

Loading…
Cancel
Save