Skip to content

Commit

Permalink
fix NullPointerException when loading the application icon
Browse files Browse the repository at this point in the history
  • Loading branch information
lucalewin committed Sep 19, 2021
1 parent 58fcb99 commit 801e10c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.stage.Stage;
import net.lucraft.converter.Config;

import java.io.IOException;
import java.util.Objects;

public class ConverterApplication extends Application {
@Override
Expand All @@ -16,8 +18,7 @@ public void start(Stage stage) throws IOException {
Screen screen = Screen.getPrimary();
Scene scene = new Scene(fxmlLoader.load(), screen.getBounds().getWidth() / 2, screen.getBounds().getHeight() / 2);
stage.setTitle("Converter - Lucraft");
// System.out.println(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("net/lucraft/converter/icons/icon.png")).getPath());
// stage.getIcons().add(new Image(Objects.requireNonNull(getClass().getClassLoader().getResourceAsStream("net/lucraft/converter/icons/icon.png"))));
stage.getIcons().add(new Image(Objects.requireNonNull(getClass().getResourceAsStream("/net/lucraft/converter/icons/icon.png"))));
stage.setScene(scene);

stage.setOnCloseRequest(event -> {
Expand Down

0 comments on commit 801e10c

Please sign in to comment.