Why " no capability to remove children()"

public Scene s = null;
bjectFile f = new ObjectFile(flags,
(float)(creaseAngle * Math.PI / 180.0));

   s = f.load(filename);

and when I want to change the obj file ,first i use the "objTrans.removeChild(s.getSceneGroup()); "
then the wrong appear: (please help me)

javax.media.j3d.CapabilityNotSetException: Group: no capability to remove children()
at javax.media.j3d.Group.removeChild(Group.java:349)()
at ObjLoad.change(ObjLoad.java:257)()
at ObjLoad.actionPerformed(ObjLoad.java:249)()
at java.awt.Button.processActionEvent(Button.java:381)()
at java.awt.Button.processEvent(Button.java:350)()
at java.awt.Component.dispatchEventImpl(Component.java:3639)()
at java.awt.Component.dispatchEvent(Component.java:3480)()
at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)()
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)()
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)()
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)()
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)()
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)()

This is probably pointing out the obvious, but don’t you have to set a capability bit in the node to allow removing of children?

The group must have

.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE)

and

.setCapability(BranchGroup.ALLOW_CHILDREN_READ)

The element being removed must be a branch group and have

.setCapability(BranchGroup.ALLOW_DETACH)

called on it.

Kev

Note that you only need to set the capability bits if the BranchGroup is part of a live or compiled scene graph.

Also, if you don’t think you’ll be doing the remove very often then you might want to set the capabilityIsFrequent(?) to false for that capability, to help Java3D optimize the scene graph.

Thanks a lot.I have a lot to learn…