Skip to content

Commit 1f0f828

Browse files
committed
Now can close the app via Escape key.
1 parent cc030e4 commit 1f0f828

File tree

6 files changed

+8
-3
lines changed

6 files changed

+8
-3
lines changed

src/main/java/io/github/coderodde/pathfinding/app/PathFindingApp.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import io.github.coderodde.pathfinding.utils.GridBounds;
88
import io.github.coderodde.pathfinding.view.GridView;
99
import javafx.application.Application;
10+
import javafx.application.Platform;
1011
import javafx.scene.Scene;
12+
import javafx.scene.input.KeyCode;
1113
import javafx.scene.layout.Pane;
1214
import javafx.stage.Screen;
1315
import javafx.stage.Stage;
@@ -64,6 +66,12 @@ public void start(Stage stage) throws Exception {
6466
Scene scene = new Scene(root,
6567
view.getWidth(),
6668
view.getHeight());
69+
70+
scene.setOnKeyPressed(event -> {
71+
if (event.getCode() == KeyCode.ESCAPE) {
72+
Platform.exit();
73+
}
74+
});
6775

6876
stage.initStyle(StageStyle.UNDECORATED);
6977
stage.setMaximized(true);

target/PathFinding.java-1.0.0.jar

-77.3 KB
Binary file not shown.
Binary file not shown.

target/maven-archiver/pom.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst

Whitespace-only changes.

target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

Whitespace-only changes.

0 commit comments

Comments
 (0)