Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Something wrong with the import things

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Something wrong with the import things

    Hi
    i try to run the program below, but i don't know why i can't run it.
    There is something wrong with the import com.sun.j3d, how can i fix it?
    Thank you

    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
     
    import javax.media.j3d.*;
    import javax.vecmath.*;
     
    import com.sun.j3d.utils.applet.MainFrame;
     
    import com.sun.j3d.loaders.objectfile.ObjectFile;
    import com.sun.j3d.loaders.Scene;
     
    import javax.swing.JFrame;
    import javax.swing.WindowConstants;
     
    /**
    * Renders a 3D shape using a 3D rendering engine
    * that was written from scratch using AWT for
    * graphics operations.
    */
    public class main extends JFrame
    {
    	private static int 				m_kWidth = 400;
    	private static int 				m_kHeight = 400;
     
       private RenderingEngine			renderingEngine = new AwtRenderingEngine();
       private GeometryUpdater			geometryUpdater = new RotatingGeometryUpdater();
       private RenderingSurface		renderingSurface;
     
    	public main( )
    	{
       	// load the object file
    		Scene scene = null;
    		Shape3D shape = null;
     
    		// read in the geometry information from the data file
    		ObjectFile objFileloader = new ObjectFile( ObjectFile.RESIZE );
     
    		try
    		{
    			scene = objFileloader.load( "hand1.obj" );
    		}
    		catch ( Exception e )
    		{
    			scene = null;
    			System.err.println( e );
    		}
     
    		if( scene == null )
    			System.exit( 1 );
     
    		// retrieve the Shape3D object from the scene
    		BranchGroup branchGroup = scene.getSceneGroup( );
    		shape = (Shape3D) branchGroup.getChild( 0 );
     
           GeometryArray geometryArray = (GeometryArray) shape.getGeometry();
     
           // add the geometry to the rendering engine...       
           renderingEngine.addGeometry( geometryArray );
     
           // create a rendering surface and bind the rendering engine
           renderingSurface = new RenderingSurface( renderingEngine, geometryUpdater );
     
           // start the rendering surface and add it to the content panel
           renderingSurface.start();
           getContentPane().add( renderingSurface );
     
        	// disable automatic close support for Swing frame.
    		setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
     
    		// adds the window listener
    		addWindowListener( 
    			new WindowAdapter()
    			{
    				// handles the system exit window message
    				public void windowClosing( WindowEvent e )
    				{
    					System.exit( 0 );				
                   }
    			}
    		);
    	}
     
    	public static void main( String[] args )
    	{
    		main main = new main();
    		main.setTitle( "3D" );
    		main.setSize( 300, 300 );
    		main.setVisible( true );
    	}
    }


  2. #2
    Member
    Join Date
    May 2010
    Posts
    36
    Thanks
    0
    Thanked 13 Times in 12 Posts

    Default Re: Something wrong with the import things

    Quote Originally Posted by mingming8888 View Post
    i try to run the program below, but i don't know why i can't run it.
    There is something wrong with the import com.sun.j3d, how can i fix it?
    add the j3d-jars to your classpath. can you please attach the file hand1.obj?
    Last edited by j2me64; August 25th, 2010 at 03:56 AM.

  3. #3
    Junior Member
    Join Date
    Aug 2010
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Something wrong with the import things

    Here is the hand1.obj
    Attached Files Attached Files

  4. #4
    Junior Member
    Join Date
    Aug 2010
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Something wrong with the import things

    i have added j3dtree.jar

Similar Threads

  1. Displaying things in gui
    By KrisTheSavage in forum AWT / Java Swing
    Replies: 2
    Last Post: March 29th, 2010, 12:21 PM
  2. XML, and other things.
    By Tortex in forum The Cafe
    Replies: 0
    Last Post: March 27th, 2010, 03:33 PM
  3. How would i do these things??
    By Curious in forum Java Theory & Questions
    Replies: 4
    Last Post: February 21st, 2010, 08:33 PM
  4. Java is resetting my variables to zero, and other mysterious things
    By schcrosby in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 12th, 2010, 09:50 PM
  5. [SOLVED] Prime number generator program in Java
    By big_c in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 27th, 2009, 12:08 PM