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 0c59c7e540
commit 5333210549
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13

View File

@ -1,6 +1,8 @@
package dev.kske.chess.ui; package dev.kske.chess.ui;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -35,6 +37,15 @@ public class GameModeDialog extends JDialog {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 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 BoardComponent boardComponent = boardPane.getBoardComponent();
final OverlayComponent overlayComponent = boardPane.getOverlayComponent(); final OverlayComponent overlayComponent = boardPane.getOverlayComponent();
final Board board = boardComponent.getBoard(); final Board board = boardComponent.getBoard();