Bort med logger + fallthrough

This commit is contained in:
lov3b 2022-05-15 22:21:01 +02:00
parent d8bdacdb80
commit 0d80b0e37c
2 changed files with 5 additions and 12 deletions

View File

@ -122,20 +122,15 @@ public class Board extends JPanel implements MouseListener {
JOptionPane.showMessageDialog(this, "Du står i schack");
break;
case SCHACKMATT:
if (JOptionPane.showConfirmDialog(this, "Schackmatt\nVill du starta om?") == JOptionPane.YES_OPTION) {
try {
restartGame();
} catch (IOException ex) {
Logger.getLogger(Board.class.getName()).log(Level.SEVERE, null, ex);
}
}
break;
case PATT:
if (JOptionPane.showConfirmDialog(this, "Patt\nVill du starta om?") == JOptionPane.YES_OPTION) {
String stateStr = state.toString();
String msg = stateStr.charAt(0) + stateStr.substring(1, stateStr.length()).toLowerCase();
int choice = JOptionPane.showConfirmDialog(this, msg + "\nVill du starta om?");
if (choice == JOptionPane.YES_OPTION) {
try {
restartGame();
} catch (IOException ex) {
Logger.getLogger(Board.class.getName()).log(Level.SEVERE, null, ex);
}
}
break;

View File

@ -76,7 +76,6 @@ public class Schack {
try {
board.restartGame();
} catch (IOException ex) {
Logger.getLogger(Schack.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
@ -88,7 +87,6 @@ public class Schack {
try {
board.restartGame();
} catch (IOException ex) {
Logger.getLogger(Schack.class.getName()).log(Level.SEVERE, null, ex);
}
}
});