31

Creating a Java 3D application or applet
HelloUniverse Example Code

  • Construct the view and content branches
  • Use SimpleUniverse to make a typical view branch
  • public HelloUniverse( ) {
        Canvas3D c = new Canvas3D( null );
        add( "Center", c );
    
        // Create View Branch
        SimpleUniverse u = new SimpleUniverse( c );
    
        // Create Content Branch
        BranchGroup scene = createSceneGraph( );
        u.addBranchGraph( scene );
    }