]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/threedee/WindowFactory.java
Version 2, March 2007
[GpsPrune.git] / tim / prune / threedee / WindowFactory.java
1 package tim.prune.threedee;
2
3 import javax.swing.JFrame;
4
5 import tim.prune.App;
6
7 /**
8  * Factory class for getting a Window
9  */
10 public abstract class WindowFactory
11 {
12         private static ThreeDWindow _window = null;
13
14         /**
15          * Get a Window object
16          * @param inApp App object
17          * @param inFrame parent frame
18          * @return object if available, otherwise null
19          */
20         public static ThreeDWindow getWindow(App inApp, JFrame inFrame)
21         {
22                 if (isJava3dEnabled())
23                 {
24                         if (_window == null) _window = new Java3DWindow(inApp, inFrame);
25                         return _window;
26                 }
27                 return null;
28         }
29
30
31         /**
32          * @return true if 3d capability is installed
33          */
34         private static boolean isJava3dEnabled()
35         {
36                 boolean has3d = false;
37                 try
38                 {
39                         Class universeClass = Class.forName("com.sun.j3d.utils.universe.SimpleUniverse");
40                         has3d = true;
41                 }
42                 catch (ClassNotFoundException e)
43                 {
44                         // no java3d classes available
45                 }
46                 return has3d;
47         }
48
49 }