Java - problemas de librerias en free java

   
Vista:

problemas de librerias en free java

Publicado por oskar (2 intervenciones) el 04/06/2008 00:19:18
-// este es mi problema lo que pasa que ocupo java 3d en un programa de free java y este codigo es para reproducir sonido y ala hora de compilar marca un error de libreria o que la libreria está dañana. cual sería la solucion de mi problema?





import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
//import com.sun.j3d.utils.universe.Viewer.createAudioDevice;
import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.geometry.Cone;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.applet.Applet;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.io.File;
import java.security.*;
import com.sun.j3d.utils.geometry.*;

public class sonido extends Applet{
public sonido(){
setLayout(new BorderLayout());
GraphicsConfiguration config= SimpleUniverse.getPreferredConfiguration();

Canvas3D canvas3D = new Canvas3D(config);
add("Center",canvas3D);

BranchGroup scene = createSceneGraph();
scene.compile();

SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
simpleU.getViewingPlatform().setNominalViewingTransform();

AudioDevice audioDev = simpleU.getViewer().createAudioDevice();
simpleU.addBranchGraph(scene);

}
public BranchGroup createSceneGraph(){
BranchGroup objRoot = new BranchGroup();
Transform3D translate=new Transform3D();
Transform3D tempRotate = new Transform3D();
URL url=null;

translate.set(new Vector3f(0.7f,0.0f,0.0f));
tempRotate.rotX(Math.PI/3.0d);

TransformGroup objTranslate = new TransformGroup(translate);
TransformGroup objRotate = new TransformGroup(tempRotate);

TransformGroup objSpin = new TransformGroup();
objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

objRoot.addChild(objSpin);
objSpin.addChild(objTranslate);
objTranslate.addChild(objRotate);

objRotate.addChild(new ColorCube(0.2f));
objRoot.addChild(new Cone(0.3f,0.6f));

Transform3D yAxis=new Transform3D();
Alpha rotationAlpha=new Alpha(-1,3000);

RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,objSpin,yAxis,0.0f,(float) Math.PI*2.0f);

BoundingSphere bounds= new BoundingSphere(new Point3d(), Double.MAX_VALUE);

rotator.setSchedulingBounds(bounds);
objSpin.addChild(rotator);

DirectionalLight azul =new DirectionalLight(new Color3f(0.5f,1.0f,1.0f), new Vector3f(0f,0.0f,-0.1f));

//DirectionalLight azul = new DirectionalLight(new Color3f(0.5f,1.0f),new Vector3f(0f,0.0f,-1.0f));
azul.setInfluencingBounds(bounds);
objRoot.addChild(azul);

DirectionalLight gris= new DirectionalLight(new Color3f(0.8f,0.8f,0.8f),new Vector3f(0f,0.0f,-1.0f));

gris.setInfluencingBounds(bounds);
objSpin.addChild(gris);

//Sonido de fondo

try
{
url =new URL("file:./color.au");
}
catch(Exception e){
System.out.println(e.getMessage());
}

MediaContainer sonidoMedia=new MediaContainer();
sonidoMedia.setCapability(MediaContainer.ALLOW_URL_WRITE);
sonidoMedia.setCapability(MediaContainer.ALLOW_URL_READ);
sonidoMedia.setURLObject(url);
sonidoMedia.setCacheEnable(false);

BackgroundSound bgSound = new BackgroundSound();

bgSound.setCapability(Sound.ALLOW_SOUND_DATA_READ);
bgSound.setCapability(Sound.ALLOW_ENABLE_WRITE);
bgSound.setCapability(Sound.ALLOW_INITIAL_GAIN_WRITE);
bgSound.setCapability(Sound.ALLOW_SOUND_DATA_WRITE);
bgSound.setCapability(Sound.ALLOW_SCHEDULING_BOUNDS_WRITE);
bgSound.setCapability(Sound.ALLOW_CONT_PLAY_WRITE);
bgSound.setCapability(Sound.ALLOW_RELEASE_WRITE);
bgSound.setCapability(Sound.ALLOW_DURATION_READ);
bgSound.setCapability(Sound.ALLOW_IS_PLAYING_READ);
bgSound.setCapability(Sound.ALLOW_LOOP_WRITE);

bgSound.setSoundData(sonidoMedia);
bgSound.setSchedulingBounds(bounds);
bgSound.setEnable(true);
bgSound.setLoop(Sound.INFINITE_LOOPS);

objRoot.addChild(bgSound);

return objRoot;

}

public static void main(String[] args){
sonido applet = new sonido();
Frame frame = new MainFrame(applet,256,256);
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder