Made application terminate when GameModeDialog is closed

This commit is contained in:
Kai S. K. Engelbart 2019-07-12 13:33:34 +02:00
parent 4f57c34a81
commit 54e73f2b85

View File

@ -1,6 +1,8 @@
package dev.kske.chess.ui;
import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap;
import java.util.Map;
@ -35,6 +37,15 @@ public class GameModeDialog extends JDialog {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
// Exit application when the close button is pressed
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
});
final BoardComponent boardComponent = boardPane.getBoardComponent();
final OverlayComponent overlayComponent = boardPane.getOverlayComponent();
final Board board = boardComponent.getBoard();