From 9d5ed00f8b0756f344b67a121a0ca21221e356e5 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Mon, 1 Jul 2019 17:26:23 +0200 Subject: [PATCH] Adjusted column names in ScoreDialog --- src/dev/kske/minesweeper/Minesweeper.java | 16 +++++++--------- src/dev/kske/minesweeper/ScoreDialog.java | 7 +++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/dev/kske/minesweeper/Minesweeper.java b/src/dev/kske/minesweeper/Minesweeper.java index e5c59af..f09151c 100644 --- a/src/dev/kske/minesweeper/Minesweeper.java +++ b/src/dev/kske/minesweeper/Minesweeper.java @@ -115,11 +115,7 @@ public class Minesweeper { JLabel lblRemainingMines = new JLabel("Remaining Mines: " + EASY.mines); panel.add(lblRemainingMines, BorderLayout.SOUTH); lblRemainingMines.setHorizontalAlignment(SwingConstants.LEFT); - btnRestart.addActionListener((evt) -> { - board.reset(); - gameTime = 0; - timer.restart(); - }); + btnRestart.addActionListener((evt) -> { board.reset(); gameTime = 0; timer.restart(); }); mframe.pack(); board.registerGameListener(new GameListener() { @@ -204,12 +200,14 @@ public class Minesweeper { menubar.add(highscoreMenu); } - var aboutMenuItem = new JMenuItem("About"); + { + var aboutMenuItem = new JMenuItem("About"); - aboutMenuItem.addActionListener((evt) -> JOptionPane.showMessageDialog(board, - "Minesweeper version " + VERSION + "\nby Kai S. K. Engelbart")); + aboutMenuItem.addActionListener((evt) -> JOptionPane.showMessageDialog(board, + "Minesweeper version " + VERSION + "\nby Kai S. K. Engelbart")); - menubar.add(aboutMenuItem); + menubar.add(aboutMenuItem); + } mframe.setJMenuBar(menubar); } diff --git a/src/dev/kske/minesweeper/ScoreDialog.java b/src/dev/kske/minesweeper/ScoreDialog.java index be8e53d..f97ceb5 100644 --- a/src/dev/kske/minesweeper/ScoreDialog.java +++ b/src/dev/kske/minesweeper/ScoreDialog.java @@ -32,16 +32,15 @@ public class ScoreDialog extends JDialog { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); getContentPane().setLayout(new BorderLayout(0, 0)); - String[] columnNames = { "Place", "Name", "Game duration", "Board Config", "Date" }; - String[][] data = new String[scores.size()][5]; + String[] columnNames = { "Place", "Name", "Duration", "Date" }; + String[][] data = new String[scores.size()][4]; Iterator iter = scores.iterator(); for(int i = 0; i < data.length; i++) { Score s = iter.next(); data[i][0] = String.valueOf(i + 1); data[i][1] = s.getName(); data[i][2] = String.valueOf(s.getDuration()); - data[i][3] = boardConfigName; - data[i][4] = new SimpleDateFormat().format(s.getDate()); + data[i][3] = new SimpleDateFormat().format(s.getDate()); } mtable = new JTable(data, columnNames);