your scene variable also has to be final.
An alternative is to add a removeChild method to your current class and call it
from your action listener class :

class yourClass
{

  final Button button1 = new Button("Stop");
  button1.addActionListener( new ActionListener() {
      public void actionPerformed(ActionEvent e)
            {
                 removeChild(1);
             }
    );

removeChild(int i)
{
         scene.removeChild(1);
}

}

hope this helps.

Pascal.

SUBSCRIBE JAVA3D-INTEREST peter wrote:

> dear all:
>  i have created a button and when it was pressed, a child under a BG will reomve.and 
>the coding like below:
>
>   final Button button1 = new Button("Stop");
>   button1.addActionListener( new ActionListener() {
>       public void actionPerformed(ActionEvent e)
>             {
>              scene.removeChild(1);
>              }
>     );
>
> where scene is a Group or BG.But when compile , it show the error message "Attemptto 
>use a non-final variable scen from a different method,From enclosing blocks,only 
>final local variable are available"
>
> Can anyone help me!Urengy.And need the whole source coding to take a look,pls tell 
>me.thx..
>
> ===========================================================================
> 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".

Reply via email to