Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: joelib/gui/molviewer/java3d/util/Java3DHelper.java


1   ///////////////////////////////////////////////////////////////////////////////
2   //  Filename: $RCSfile: Java3DHelper.java,v $
3   //  Purpose:  Test class for the Java3D configuration
4   //  Language: Java
5   //  Compiler: JDK 1.4
6   //  Authors:  Gert Sclep
7   //  Version:  $Revision: 1.1 $
8   //            $Date: 2003/08/22 16:16:39 $
9   //            $Author: wegner $
10  //
11  //  Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
12  //
13  //  This program is free software; you can redistribute it and/or modify
14  //  it under the terms of the GNU General Public License as published by
15  //  the Free Software Foundation version 2 of the License.
16  //
17  //  This program is distributed in the hope that it will be useful,
18  //  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  //  GNU General Public License for more details.
21  ///////////////////////////////////////////////////////////////////////////////
22  package joelib.gui.molviewer.java3d.util;
23  
24  
25  /*==========================================================================*
26   * IMPORTS
27   *==========================================================================  */
28  import java.awt.GraphicsConfiguration;
29  import java.awt.GraphicsDevice;
30  import java.awt.GraphicsEnvironment;
31  
32  import javax.media.j3d.Canvas3D;
33  import javax.media.j3d.GraphicsConfigTemplate3D;
34  
35  
36  /*==========================================================================*
37   * CLASS DECLARATION
38   *==========================================================================  */
39  
40  /**
41   * Test class for the Java3D configuration. If no Canvas3D-object can be
42   * constructed, or the graphics board is too old, or the graphics device isn't
43   * properly configured.
44   *
45   * @author     gsclep
46   * @license    GPL
47   */
48  public class Java3DHelper
49  {
50      //~ Methods ////////////////////////////////////////////////////////////////
51  
52      public static boolean configOK()
53      {
54          GraphicsConfigTemplate3D tmpl = new GraphicsConfigTemplate3D();
55          GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
56          GraphicsDevice device = env.getDefaultScreenDevice();
57          GraphicsConfiguration config = device.getBestConfiguration(tmpl);
58  
59          try
60          {
61              Canvas3D canvas = new Canvas3D(config);
62  
63              return true;
64          }
65           catch (Exception exc)
66          {
67              return false;
68          }
69      }
70  }
71  ///////////////////////////////////////////////////////////////////////////////
72  //  END OF FILE.
73  ///////////////////////////////////////////////////////////////////////////////