public MovingLight() {
    // Mechanism for closing the window and ending the program.
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Default settings for the viewer parameters.
    myCanvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());

    // Construct the SimpleUniverse:
    // First generate it using the Canvas.
    SimpleUniverse simpUniv = new SimpleUniverse(myCanvas3D);

    // Default position of the viewer.
    simpUniv.getViewingPlatform().setNominalViewingTransform();

    // The scene is generated in this method.
    createSceneGraph(simpUniv);

    // Add some light to the scene.
    addLight(simpUniv);

    // The following three lines enable navigation through the scene using the mouse.
    OrbitBehavior ob = new OrbitBehavior(myCanvas3D);
    ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), Double.MAX_VALUE));
    simpUniv.getViewingPlatform().setViewPlatformBehavior(ob);

    // Show the canvas/window.
    setTitle("A moving light source");
    setSize(700, 700);
    getContentPane().add("Center", myCanvas3D);
    setVisible(true);
  }
  private void initMouseControl() {
    if (getSettings().getRenderSettings().getRenderMode().contains(RenderMode.RENDER_TO_FRAME)) {
      OrbitBehavior orbitBehavior = new OrbitBehavior();
      orbitBehavior.setSchedulingBounds(getSettings().getRenderSettings3D().getBounds());
      getViewingPlatform().setViewPlatformBehavior(orbitBehavior);

      getLogger().info("Simple mouse control initialized.");
    }
  }