Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

exceptions!!

843799Aug 2 2001 — edited Aug 3 2001
when try to compile my code
-----------------------------------
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.*;
public class Main
{
public Main()
{
Transform3D tf=new Transform3D();
TransformGroup trans=new TransformGroup();
Vector3f vec=new Vector3f(0.0f,-4.0f,0.2f);
SimpleUniverse su=new SimpleUniverse();
BranchGroup bg=new BranchGroup();
ColorCube cc=new ColorCube(0.10f);
tf.setTranslation(vec);
trans.setTransform(tf);
trans.addChild(cc);
bg.addChild(cc);
su.getViewingPlatform().setNominalViewingTransform();
su.addBranchGraph(bg);
}
public static void main(String[] args)
{
Main m=new Main();
}
}
---------------------------------------------------
i get these exceptions
---------------------------------------------------
javax.media.j3d.MultipleParentException: Group.addChild: child already has a parent
at javax.media.j3d.GroupRetained.checkValidChild(GroupRetained.java:397)
at javax.media.j3d.GroupRetained.addChild(GroupRetained.java:406)
at javax.media.j3d.Group.addChild(Group.java:261)
at Main.<init>(Main.java:19)
at Main.main(Main.java:25)
-------------------------------------------------
someone can plz help me?

Comments

843799
Your adding ColorCube cc both to bg and trans. This is not allowed. Guess you wante add trans to bg.
843799
so how can i add trans to colorcube
843799
Yes, you are adding the cube twice. Add the cube to the TransformGroup, then add the TransformGroup to the BranchGroup. That should work.
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 31 2001
Added on Aug 2 2001
3 comments
172 views