Thank you very much!

I didn't think of the way of traversing a BranchGroup. That makes a lot of
sense thinking of it now.
cheers!

Lan

At 11:47 AM 3/11/2002 -0500, you wrote:
>Hi Lan
>
>for( int i = theGroup.numChildren() - 1; i >= 0; --i ){
>         theGroup.removeChild( i );
>}
>
>-Raffi
>
>-----Original Message-----
>From: Lan Wu-Cavener [mailto:[EMAIL PROTECTED]]
>Sent: Monday, March 11, 2002 10:38 AM
>To: [EMAIL PROTECTED]
>Subject: [JAVA3D] dispose the children of a detached BranchGroup
>
>
>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".
>
>===========================================================================
>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".

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