Skip to content

Commit 6f47b5d

Browse files
author
jbilander
committed
Fixed so path to resources works on all platforms
1 parent cecd313 commit 6f47b5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/example/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public class Main extends Application {
1414
public void start(Stage stage) throws Exception {
1515

1616
if (!(Util.isWindows() || Util.isMac())) { //Load Arial font for all *nix platforms
17-
Font.loadFont(getClass().getResource(Util.FILE_SEPARATOR + "Arial.ttf").toExternalForm(), 12);
17+
Font.loadFont(getClass().getClassLoader().getResource("Arial.ttf").toExternalForm(), 12);
1818
}
1919

2020
RootView rootView = new RootView();
2121
Pane root = rootView.getView();
2222
Scene scene = new Scene(root, Util.APP_WIDTH, Util.APP_HEIGHT);
23-
scene.getStylesheets().add(getClass().getResource(Util.FILE_SEPARATOR + "app.css").toExternalForm());
23+
scene.getStylesheets().add(getClass().getClassLoader().getResource("app.css").toExternalForm());
2424
stage.setTitle(Util.TITLE);
2525
stage.setScene(scene);
2626
stage.show();

0 commit comments

Comments
 (0)