diff options
author | phil <[email protected]> | 2016-10-26 13:35:49 +1300 |
---|---|---|
committer | phil <[email protected]> | 2016-10-26 13:35:49 +1300 |
commit | 44dd75f8741d5c79592b7f2e15091151fcce9c5b (patch) | |
tree | 697dcc8c7ef6fe6c4ae54814c8deab3231999e88 /src/classes/org/jdesktop/j3d/examples/Resources.java | |
parent | d1288f7ae0de87455a2988c1f15dedda2074823f (diff) |
New Overlay2D example for use of the Graphics2D of Canvas3D
Diffstat (limited to 'src/classes/org/jdesktop/j3d/examples/Resources.java')
-rw-r--r-- | src/classes/org/jdesktop/j3d/examples/Resources.java | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/Resources.java b/src/classes/org/jdesktop/j3d/examples/Resources.java index 4010201..a50a188 100644 --- a/src/classes/org/jdesktop/j3d/examples/Resources.java +++ b/src/classes/org/jdesktop/j3d/examples/Resources.java @@ -51,34 +51,40 @@ import java.net.URL; /** * */ -public class Resources { - - /** - * Do not construct an instance of this class. - */ - private Resources() { - - } +public class Resources +{ - /** - * Return the URL of the filename under the resources directory - */ - public static URL getResource(String filename) { - URL url = Resources.class.getClassLoader().getResource(filename); - - if(url == null) - { - try + /** + * Do not construct an instance of this class. + */ + private Resources() + { + + } + + /** + * Return the URL of the filename under the resources directory + */ + public static URL getResource(String filename) + { + URL url = Resources.class.getClassLoader().getResource(filename); + + if (url == null) + { + try { - url = new File(System.getProperty("user.dir") + "/src/classes/org/jdesktop/j3d/examples/"+filename).toURL(); + File f = new File(System.getProperty("user.dir") + "/src/" + filename); + if (!f.exists()) + f = new File(System.getProperty("user.dir") + "/src/classes/org/jdesktop/j3d/examples/" + filename); + + url = f.toURL(); } catch (MalformedURLException e) { e.printStackTrace(); } - } - return url; - } - - + } + return url; + } + } |