From 44dd75f8741d5c79592b7f2e15091151fcce9c5b Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 26 Oct 2016 13:35:49 +1300 Subject: New Overlay2D example for use of the Graphics2D of Canvas3D --- .../org/jdesktop/j3d/examples/Resources.java | 52 ++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'src/classes/org/jdesktop/j3d/examples/Resources.java') 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; + } + } -- cgit v1.2.3