What do you think ? Here’s the code in BranchGroup ?
public class BranchGroup extends Group {
/**
* Constructs a new BranchGroup object.
*/
public BranchGroup() {
super();
}
/**
* Detaches the BranchGroup node from its parent. Sets
* the node to not live.
*/
public final void detach() {
if (View.CHECK_FOR_ILLEGAL_MODIFICATION) View.checkForIllegalModification(this);
Node p = getParent();
if(p!=null)
{
if(p instanceof Group)
((Group)p).removeChild(this);
else
{
throw new SceneGraphRuntimeException("BranchGroup.detach(): An unknown node type is the parent.");
}
}
}
}
I think it would simplify the code a bit.