X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fthreedee%2FWindowFactory.java;h=549c11a1ef97439899d759c22fa1a9fa84cfab90;hb=b361869e590bbca32664c16ac24d6296926594a5;hp=89560efa1b2b7e592c8c7dfa2412bc8bf4b72a23;hpb=23959e65a6a0d581e657b07186d18b7a1ac5afeb;p=GpsPrune.git diff --git a/tim/prune/threedee/WindowFactory.java b/tim/prune/threedee/WindowFactory.java index 89560ef..549c11a 100644 --- a/tim/prune/threedee/WindowFactory.java +++ b/tim/prune/threedee/WindowFactory.java @@ -2,26 +2,28 @@ package tim.prune.threedee; import javax.swing.JFrame; -import tim.prune.App; - /** * Factory class for getting a Window */ public abstract class WindowFactory { - private static ThreeDWindow _window = null; + private static Java3DWindow _window = null; /** * Get a Window object - * @param inApp App object * @param inFrame parent frame * @return object if available, otherwise null */ - public static ThreeDWindow getWindow(App inApp, JFrame inFrame) + public static ThreeDWindow getWindow(JFrame inFrame) { if (isJava3dEnabled()) { - if (_window == null) _window = new Java3DWindow(inApp, inFrame); + if (_window == null) { + _window = new Java3DWindow(inFrame); + } + else { + _window.dispose(); + } return _window; } return null; @@ -31,18 +33,22 @@ public abstract class WindowFactory /** * @return true if 3d capability is installed */ - private static boolean isJava3dEnabled() + public static boolean isJava3dEnabled() { boolean has3d = false; try { - Class universeClass = Class.forName("com.sun.j3d.utils.universe.SimpleUniverse"); - has3d = true; + Class universeClass = Class.forName("com.sun.j3d.utils.universe.SimpleUniverse"); + has3d = (universeClass != null); } catch (ClassNotFoundException e) { // no java3d classes available } + catch (UnsatisfiedLinkError ule) + { + // java3d available but somehow incompatible? + } return has3d; }