Fixed remaining mines counter not showing on startup
This commit is contained in:
parent
feb519c7cc
commit
04643dd702
@ -90,7 +90,6 @@ public class Board extends JPanel {
|
|||||||
for (int j = 0; j < boardHeight; j++)
|
for (int j = 0; j < boardHeight; j++)
|
||||||
board[i][j] = new Tile();
|
board[i][j] = new Tile();
|
||||||
initMines();
|
initMines();
|
||||||
notifyFlaggedTilesEvent(new FlaggedTilesEvent(this, flaggedTiles));
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class Minesweeper {
|
|||||||
mframe.getContentPane().add(headerPanel, BorderLayout.NORTH);
|
mframe.getContentPane().add(headerPanel, BorderLayout.NORTH);
|
||||||
headerPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
headerPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
||||||
|
|
||||||
JLabel lblRemainingMines = new JLabel("Remaining Mines:");
|
JLabel lblRemainingMines = new JLabel("Remaining Mines: " + easyConfig.mines);
|
||||||
lblRemainingMines.setHorizontalAlignment(SwingConstants.LEFT);
|
lblRemainingMines.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
headerPanel.add(lblRemainingMines);
|
headerPanel.add(lblRemainingMines);
|
||||||
|
|
||||||
@ -108,6 +108,7 @@ public class Minesweeper {
|
|||||||
});
|
});
|
||||||
|
|
||||||
JButton btnRestart = new JButton("Restart");
|
JButton btnRestart = new JButton("Restart");
|
||||||
|
btnRestart.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
headerPanel.add(btnRestart);
|
headerPanel.add(btnRestart);
|
||||||
btnRestart.addActionListener((evt) -> board.reset());
|
btnRestart.addActionListener((evt) -> board.reset());
|
||||||
mframe.pack();
|
mframe.pack();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user