Color3f specularColourFBox = new Color3f(0.8f,0.0f,0.0f);
float shininessFBox = 10.0f;
Appearance fBoxApp = new Appearance();
fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
diffuseColourFBox,specularColourFBox,shininessFBox));
Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);
//The UserData are needed in order to identify the cube when it is picked.
fBox.setUserData("cube");
Transform3D tfFBox = new Transform3D();
tfFBox.rotY(Math.PI/6);
Transform3D rotationX = new Transform3D();
rotationX.rotX(-Math.PI/5);
tfFBox.mul(rotationX);
TransformGroup tgFBox = new TransformGroup(tfFBox);
tgFBox.addChild(fBox);
//*** Generate a red cube including its transformation group. ***
Color3f ambientColourBSphere = new Color3f(0.0f,0.6f,0.0f);
Color3f emissiveColourBSphere = new Color3f(0.0f,0.0f,0.0f);
Color3f diffuseColourBSphere = new Color3f(0.0f,0.6f,0.0f);
Color3f specularColourBSphere = new Color3f(0.0f,0.6f,0.0f);
float shininessBSphere = 2.0f;
Appearance bSphereApp = new Appearance();
bSphereApp.setMaterial(new Material(ambientColourBSphere,emissiveColourBSphere,
diffuseColourBSphere,specularColourBSphere,shininessBSphere));
Sphere bSphere = new Sphere(0.4f,bSphereApp);
//The UserData are needed in order to identify the sphere when it is picked.