The exception indicate that you can't add to your exisitng Group. Trying
adding a sceneGroup of type BranchGroup. I suppose this might work:
Instead of
> root.addChild(scene); // root is BranchGroup
do:
BranchGroup sceneGroup = new BranchGroup();
root.addChild( sceneGroup );
sceneGroup.addChild( scene );
Then you may be able to use sceneGroup.addChild from then onwards. (You may
have to set the capability bits as well for sceneGroup.)
Kovalan
----- Original Message -----
From: Dong-Woo Lee <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 17, 1999 12:59 PM
Subject: [JAVA3D] how can I addChild in run time?
> My program build some scene using internal
> buildScene().
>
> Group objRoot = buildScene();
>
> objRoot.setCapability(Group.ALLOW_CHILDREN_READ);
> objRoot.setCapability(Group.ALLOW_CHILDREN_WRITE);
> objRoot.setCapability(Group.ALLOW_CHILDREN_EXTEND);
>
> ..
> ..
>
> root.addChild(scene); // root is BranchGroup
> ..
> ..
>
> Then, the scene is displayed. There is a button that
> add box into 'objRoot', but it occurs error.
>
> [error]
> --------- UNCAUGHT EXCEPTION ---------
> javax.media.j3d.RestrictedAccessException: Group: only
> a BranchGroup node may be added
>
> at javax.media.j3d.Group.addChild(Group.java:255)
>
>
> >>>>>>>>
>
> How can I add some node into 'objRoot' in run time
> after the initial scene is built?
>
>
>
> Thanks in advance.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".