Browse Source
Implemented fixes that apply to resource loading in the JFX Jar. Should now be launchable, configure loggers correctly, and be able to load embedded files. Added a FileLoader helper class to manage loading resources. Is not thread safe currently, but should be made so.
master
Implemented fixes that apply to resource loading in the JFX Jar. Should now be launchable, configure loggers correctly, and be able to load embedded files. Added a FileLoader helper class to manage loading resources. Is not thread safe currently, but should be made so.
master
Drew Short
11 years ago
3 changed files with 60 additions and 20 deletions
-
43src/main/java/com/sothr/imagetools/App.java
-
27src/main/java/com/sothr/imagetools/util/FileLoader.java
-
8src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala
@ -0,0 +1,27 @@ |
|||||
|
package com.sothr.imagetools.util; |
||||
|
|
||||
|
import java.io.InputStream; |
||||
|
import java.net.URL; |
||||
|
|
||||
|
/** |
||||
|
* Created by drew on 1/5/14. |
||||
|
*/ |
||||
|
public class FileLoader { |
||||
|
|
||||
|
private static final FileLoader instance = new FileLoader(); |
||||
|
|
||||
|
private FileLoader() {} |
||||
|
|
||||
|
public static FileLoader get() { |
||||
|
return instance; |
||||
|
} |
||||
|
|
||||
|
public URL getResource(String location) { |
||||
|
return Thread.currentThread().getContextClassLoader().getResource(location); |
||||
|
} |
||||
|
|
||||
|
public InputStream getResourceStream(String location) { |
||||
|
return Thread.currentThread().getContextClassLoader().getResourceAsStream(location); |
||||
|
} |
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue