diff --git a/src/main/java/com/sothr/imagetools/App.java b/src/main/java/com/sothr/imagetools/App.java index 28c7f98..30926e3 100644 --- a/src/main/java/com/sothr/imagetools/App.java +++ b/src/main/java/com/sothr/imagetools/App.java @@ -1,7 +1,7 @@ package com.sothr.imagetools; import com.sothr.imagetools.errors.ImageToolsException; -import com.sothr.imagetools.util.FileLoader; +import com.sothr.imagetools.util.ResourceLoader; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; @@ -13,8 +13,6 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; import java.util.Properties; /** @@ -71,9 +69,8 @@ public class App extends Application public void start(Stage primaryStage) throws Exception { logger.info("Image-Tools is starting"); logger.info(String.format("Launching GUI with FXML file %s", MAINGUI_FXML)); - ClassLoader cl = this.getClass().getClassLoader(); try { - Parent root = FXMLLoader.load(cl.getResource(MAINGUI_FXML)); + Parent root = FXMLLoader.load(ResourceLoader.get().getResource(MAINGUI_FXML)); primaryStage.setScene(new Scene(root)); //config main scene primaryStage.setTitle("Image Tools"); diff --git a/src/main/java/com/sothr/imagetools/util/FileLoader.java b/src/main/java/com/sothr/imagetools/util/ResourceLoader.java similarity index 72% rename from src/main/java/com/sothr/imagetools/util/FileLoader.java rename to src/main/java/com/sothr/imagetools/util/ResourceLoader.java index cf8e2cc..42e22aa 100644 --- a/src/main/java/com/sothr/imagetools/util/FileLoader.java +++ b/src/main/java/com/sothr/imagetools/util/ResourceLoader.java @@ -6,13 +6,13 @@ import java.net.URL; /** * Created by drew on 1/5/14. */ -public class FileLoader { +public class ResourceLoader { - private static final FileLoader instance = new FileLoader(); + private static final ResourceLoader instance = new ResourceLoader(); - private FileLoader() {} + private ResourceLoader() {} - public static FileLoader get() { + public static ResourceLoader get() { return instance; } diff --git a/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala b/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala index 33aad01..4601f85 100644 --- a/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala +++ b/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala @@ -10,7 +10,7 @@ import javafx.scene.Group import javafx.scene.text.Text import java.io.{IOException, File} import java.util.Scanner -import com.sothr.imagetools.util.FileLoader +import com.sothr.imagetools.util.ResourceLoader import java.net.URL /** @@ -30,7 +30,7 @@ class AppController { logger.debug("Displaying about screen") var aboutMessage = "Simple About Message" try { - aboutMessage = new Scanner(FileLoader.get().getResourceStream("documents/about")).useDelimiter("\\A").next() + aboutMessage = new Scanner(ResourceLoader.get().getResourceStream("documents/about")).useDelimiter("\\A").next() } catch { case ioe:IOException => logger.error("Unable to read about file")