21
21
import java .awt .*;
22
22
import java .awt .event .ActionEvent ;
23
23
import java .awt .event .ActionListener ;
24
+ import java .awt .event .WindowEvent ;
24
25
import java .io .File ;
25
26
import java .io .FileFilter ;
26
27
import java .util .Timer ;
@@ -38,6 +39,8 @@ public enum EditorMode { Carve, Paint };
38
39
public ActionListener saveAction ;
39
40
public ActionListener saveAsAction ;
40
41
public ActionListener openAction ;
42
+ public ActionListener exitAction ;
43
+
41
44
public ActionListener rotateLeftAction ;
42
45
public ActionListener rotateRightAction ;
43
46
public ActionListener playAction ;
@@ -89,7 +92,7 @@ public enum EditorMode { Carve, Paint };
89
92
public Editor () {
90
93
91
94
frame = new JFrame ("DelvEdit" );
92
- frame .setDefaultCloseOperation (JFrame .DISPOSE_ON_CLOSE );
95
+ frame .setDefaultCloseOperation (JFrame .DISPOSE_ON_CLOSE | JFrame . EXIT_ON_CLOSE );
93
96
94
97
Graphics .DisplayMode defaultMode = LwjglApplicationConfiguration .getDesktopDisplayMode ();
95
98
@@ -302,6 +305,12 @@ else if(file.endsWith(".bin")) {
302
305
}
303
306
};
304
307
308
+ exitAction = new ActionListener () {
309
+ public void actionPerformed (ActionEvent e ) {
310
+ frame .dispatchEvent (new WindowEvent (frame , WindowEvent .WINDOW_CLOSING ));
311
+ }
312
+ };
313
+
305
314
rotateLeftAction = new ActionListener () {
306
315
public void actionPerformed (ActionEvent event ) {
307
316
editorFrame .level .rotate90 ();
0 commit comments