bSphereApp.setMaterial(new Material(ambientColourBSphere,emissiveColourBSphere,
diffuseColourBSphere,specularColourBSphere,shininessBSphere));
//The left sphere and its transformation group.
Sphere bSphere1 = new Sphere(radius,bSphereApp);
Transform3D tfBSphere1 = new Transform3D();
tfBSphere1.setTranslation(new Vector3f(xShiftSphere,sphereLift,sphereBackShift));
TransformGroup tgBSphere1 = new TransformGroup(tfBSphere1);
tgBSphere1.addChild(bSphere1);
//The left cube and the left sphere are combined in one transformation group
//in order to position them jointly.
Transform3D tf1 = new Transform3D();
tf1.setTranslation(new Vector3f(-xShift,0.0f,0.0f));
TransformGroup tg1 = new TransformGroup(tf1);
tg1.addChild(tgFBox1);
tg1.addChild(tgBSphere1);
//The right cube with sreen door transparency.
Appearance fBoxApp2 = new Appearance();
fBoxApp2.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
diffuseColourFBox,specularColourFBox,shininessFBox));
//Generate screen door transparency.
TransparencyAttributes ta2 = new TransparencyAttributes();
ta2.setTransparencyMode(TransparencyAttributes.SCREEN_DOOR);
ta2.setTransparency(transparencyCoefficient);
fBoxApp2.setTransparencyAttributes(ta2);
Box fBox2 = new Box(cubeEdge,cubeEdge,cubeEdge,fBoxApp2);
//Position the cube.
Transform3D tfFBox2 = new Transform3D();
tfFBox2.mul(rotationX);
TransformGroup tgFBox2 = new TransformGroup(tfFBox2);
//The transformation group for the right cube.
tgFBox2.addChild(fBox2);
//The right sphere and its transformation group.
Sphere bSphere2 = new Sphere(radius,bSphereApp);
Transform3D tfBSphere2 = new Transform3D();
tfBSphere2.setTranslation(new Vector3f(-xShiftSphere,sphereLift,sphereBackShift));
TransformGroup tgBSphere2 = new TransformGroup(tfBSphere2);
tgBSphere2.addChild(bSphere2);