GraphicsConfigTemplate3D gcTemplate = new GraphicsConfigTemplate3D();
GraphicsEnvironment local = GraphicsEnvironment.getLocalGraphicsEnvironment();
  // there could be more than one screen
  GraphicsDevice screen = local.getDefaultScreenDevice();
GraphicsConfiguration configuration = screen.getBestConfiguration(gcTemplate);
// Get a Canvas3D and call its constructor with the configuration
  mainCanvas3D = new Canvas3D(configuration);
// Add the canvas to a JPanel (which is part of a JFrame ...)
  mainCanvas3D.setSize(200,200);   // and / or
  setLayout(new Border Layout)
  add("Center", mainCanvas3D)
// The general Scene graph
  VirtualUniverse myUniverse = new VirtualUniverse();
  Locale myLocale = new Locale(myUniverse);
// Create the two main branches (with your functions)
  BranchGroup myScene = myCreateSceneBranch();
  BranchGroup myView = myCreateViewBranch(mainCanvas3D); // a canvas3D is needed 
  here !
// Add the two branches to the Locale ... AT THE END !!!
  myLocale.addBranchGraph(myView);
  myLocale.addBranchGraph(myScene);