Fixed remaining mines counter not showing on startup

This commit is contained in:
Kai S. K. Engelbart 2019-04-07 16:54:24 +02:00
parent feb519c7cc
commit 04643dd702
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
2 changed files with 2 additions and 2 deletions

View File

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

View File

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