Add error catch on FXMLLoader
This commit is contained in:
parent
8dfcaa36ec
commit
c8d37c2754
|
@ -24,7 +24,15 @@ public class Main extends Application {
|
|||
public void start(Stage window) throws IOException {
|
||||
window.setTitle("Hello world");
|
||||
|
||||
Parent document = FXMLLoader.load(getClass().getResource("/fxml/Main.fxml"));
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/Main.fxml"));
|
||||
Parent document;
|
||||
|
||||
try {
|
||||
document = fxmlLoader.load();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Scene scene = new Scene(document);
|
||||
window.setScene(scene);
|
||||
window.show();
|
||||
|
|
Loading…
Reference in New Issue