Hi, every one:

I have a problem with disposing the contents of a detached Branchgroup
without setting the BranchGroup to null.
I have a BranchGroup generated dynamically through the user interacting
with the program. I need to often to detach the BranchGroup and would like
to garbage collect its children. I tried two approaches as follows:

1.
                                        int numb = theGroup.numChildren();
                                        System.out.println("numb="+numb);
                                        for (int index=0; index<numb-1; index++)
                                                theGroup.removeChild(index);

I got the error of "ArrayIndexOutOfBoundry, 19>=19 " although numb=38.

2.
                                        Enumeration enu = theGroup.getAllChildren();
                                        while (enu.hasMoreElements())
                                                        enu.nextElement().remove();

for this approach, I got required variable, found value for the last statement.

My question is how can I dispose the children of a detached BranchGroup
without setting this BranchGroup to null. I need to keep it for re-use later.

Thanks in advance for any suggestion.

Lan

Lan Wu-Cavener
Research Associate and Programmer
Dept. of Landscape Architecture

===========================================================================
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".

Reply via email to