Adjusted column names in ScoreDialog
This commit is contained in:
parent
8eab89a212
commit
9d5ed00f8b
@ -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);
|
||||
}
|
||||
|
@ -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<Score> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user