[vtkusers] Java RemoveActors

Jeff Lee jeff at cdnorthamerica.com
Mon Aug 15 07:37:56 EDT 2005


Hi Richard,
Try something like

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          Lock();
          currentRenderer.RemoveProp(act);
          UnLock();
        }
      });

If you are using vtkPanel, you could sublcass it, and add a method to do 
this (Lock and UnLock are protected).  HTH,
-Jeff

Richard Haney wrote:

> I am trying to build a Java Swing application that utilizes the VTK 
> and have been successful except for when I try to remove a 
> pre-existing actor. When I try, the application freezes. Has anyone 
> ran into this problem and if so, how did you solve it?
>
> I am using VTK42 and JDK 1.4.0.
>
> A small sample of the code I am using follows:
> (renWin is a reference to vtkPanel and actor is a reference to 
> vtkActor object)
>
> if (actor != null) {
>  renWin.GetRenderer().RemoveActor(actor);
>  // Force garbage collection!!
>  System.gc();
> }
>
> Thanks to anyone with any ideas on how to solve this.
>
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list