Skip to content

Commit c05d118

Browse files
committed
Handle non-selection
1 parent 0e28440 commit c05d118

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/com/example/pew/App.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.example.pew;
22

33
import javafx.application.Application;
4+
import javafx.application.Platform;
45
import javafx.scene.Scene;
56
import javafx.scene.control.Label;
67
import javafx.scene.layout.VBox;
@@ -40,17 +41,19 @@ public void start(Stage stage) {
4041

4142
if (Operator.getOpenFile() == null && !Operator.chooseNewFile()) {
4243
// Failed...
44+
Platform.exit();
4345
return;
4446
}
4547

4648
String javaVersion = System.getProperty("java.version");
4749
String javafxVersion = System.getProperty("javafx.version");
48-
Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
49-
// TODO: Show which file was opened.
50-
5150
String chosenFile = "Opened file: " + Operator.getOpenFile().getAbsolutePath();
5251

53-
Scene scene = new Scene(new VBox(l, new Label(chosenFile)), 320, 240);
52+
Scene scene = new Scene(new VBox(
53+
new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."),
54+
new Label(chosenFile)
55+
), 320, 240);
56+
5457
stage.setScene(scene);
5558
stage.show();
5659
}

0 commit comments

Comments
 (0)