Skip to content
Snippets Groups Projects
Commit 7038da2f authored by steyer's avatar steyer
Browse files

GameWindowAdapter

parent 10329f1c
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,8 @@ public class GameWindow extends JFrame { ...@@ -68,6 +68,8 @@ public class GameWindow extends JFrame {
menuBar.add(menu); menuBar.add(menu);
setJMenuBar(menuBar); setJMenuBar(menuBar);
addWindowListener(new GameWindowAdapter(model));
pack(); pack();
setResizable(false); setResizable(false);
setLocationRelativeTo(null); setLocationRelativeTo(null);
......
package game;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class GameWindowAdapter extends WindowAdapter {
private GameModel model;
public GameWindowAdapter(GameModel model){
this.model = model;
}
public void windowClosed(WindowEvent e) {
model.stop();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment