Hi, everyone ,
I copied J3dSwingFrame.java from Raw J3d, compling is fine , when I do
java J3dSwingFrame,i got error:

Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Node


What is that ? The source code is from Raw j3d which is correct.



grace


------------------------------------------------
/*******************************************************************************
*                      Copyright (c) 1999 Justin Couch
*                               Java Source
*
* Raw J3D Tutorial
*
* Version History
* Date        Version  Programmer
* ----------  -------  ------------------------------------------
* 01/08/1998  1.0.0    Justin Couch
*
******************************************************************************/

// no package

// Standard imports
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.media.j3d.*;
import javax.vecmath.Vector3f;
import javax.vecmath.AxisAngle4f;

// Application specific imports
// none

/**
* Test frame class for the dealing with J3D experimentation that uses Swing
* <P>
* Basic window consists of a menubar and a J3D window
*
* @author Justin Couch
* @version Who Cares!
*/
public class J3dSwingFrame extends JFrame
  implements ActionListener
{

  private JMenuItem close_menu;
  private Canvas3D canvas;

  private UniverseManager universe;

  /**
   * Construct the test frame with a menubar and 3D canvas
   */
  public J3dSwingFrame()
  {
    super("Java3D Tester");

    // Disable lightweight menus
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);

    JMenuBar menubar = new JMenuBar();

    // File menu
    JMenu file_menu = new JMenu("File");
    menubar.add(file_menu);


    close_menu = new JMenuItem("Exit");
    close_menu.addActionListener(this);
    file_menu.add(close_menu);

    setJMenuBar(menubar);

    GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
    GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice device = env.getDefaultScreenDevice();
    GraphicsConfiguration config = device.getBestConfiguration(template);

    canvas = new Canvas3D(config);

    // add the canvas to this frame. Since this is the only thing added to
    // the main frame we don't care about layout managers etc.

    getContentPane().add(canvas, "Center");

    constructWorld();

    setSize(600, 600);
  }

  /**
   * Construct everything that we want in the basic test world
   */
  private void constructWorld()
  {
    // create the basic universe
    universe = new UniverseManager();

/*
    // create a light grey coloured background
    Background bg = new Background(0.5f, 0.5f, 0.5f);
    BoundingSphere bounds = new BoundingSphere();
    bounds.setRadius(1000);
    bg.setApplicationBounds(bounds);
    universe.addWorldObject(bg);
*/

    Camera cam = new Camera();
    Vector3f loc = new Vector3f(0, 0, 10.0f);
    cam.setLocation(loc);
    cam.setHeadLight(true);
    universe.addCamera(cam);

    cam.setCanvas(canvas);

    // add some geometry
    ExampleGeometry geom = new ExampleGeometry();

    universe.addWorldObject(geom);
    universe.makeLive();
  }

  /**
   * An mouse action has occurred. Used to process menu item selection.
   *
   * @param evt The event that caused this method to be called.
   */
  public void actionPerformed(ActionEvent evt)
  {
    Object src = evt.getSource();

    if(src == close_menu)
      System.exit(0);
  }

  /**
   * Start the application....
   */
  public static void main(String[] args)
  {
    Frame frame = new J3dSwingFrame();
    frame.setVisible(true);
  }
}



________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to