[vtkusers] Java GetActors()

Jeff Lee jeff at cdnorthamerica.com
Tue Apr 17 17:10:02 EDT 2001


Brian,
The very latest vtkPanel uses no deprecated methods. In order to use the latest version, you
have to compile in the native support (usually -DVTK_USE_JAWT) in the graphics library.
This causes vtkRenderWindow (win32 or x) to include the proper code for native rendering
(look at vtkJavaAwt.h).  I don't believe this has been put into the latest system.make, and
it probably should.  Since you are using the nightlies, there is no guarantee that all this
new stuff has been integrated into the build.  It is an easy enough thing to do, though.
I'm sure that this is why the render window doesn't show up, because the method
RenderCreate, RenderInternal, and SetSizeInternal are all  empty unless the pre-processor
directive is defined.  I am using SUN and everything works fine.  This still doesn't explain
your problem with the null vtkActorCollection (with the old vtkPanel), though.

P.S.  You can tell which version of the panel you are using if you javac vtkPanel.java and
don't get any deprecation warnings.

-Jeff

Brian Henz wrote:

> There are only vtkActors in the Renderer, no vtkActors2D.  I have a seperate
> function to do removeAllActors2D.  I am using Java 1.3 on SGI.  I have not
> tried on SUN, AIX, or Linux but I hope to soon.  What flavor of unix did you
> have success on besides Linux?  And what version of vtkPanel.java are you
> using?  the most recent?  The version from April 3rd works "ok" on SGI for
> me but in the new one from April 16th no RenderWindow appears :-)
> Thanks,
>      Brian
>
> >From: Jeff Lee <jeff at cdnorthamerica.com>
> >To: Brian Henz <bjhenz at hotmail.com>
> >CC: vtkusers at public.kitware.com
> >Subject: Re: [vtkusers] Java GetActors()
> >Date: Tue, 17 Apr 2001 15:29:54 -0400
> >
> >What types of actors are in the actorcollection?  Instances of
> >vtkActor2D would not show up in the collection.  Do you have multiple
> >installations of vtk?  If so, is your classpath set to the correct
> >location?  I have the most recent version of vtk/jdk1.3 and it works
> >fine for me (on unix, linux).  That's all I can think of at the moment,
> >unless you can whip up a small sample code that shows the problem.
> >-Jeff
> >
> >Brian Henz wrote:
> >
> > >
> > >
> > > Here is the stack trace I get after GetActors() fails to return the
> > > actor collection...
> > >
> > > Exception occurred during event dispatching:
> > > java.lang.NullPointerException
> > >         at
> > > mil.army.arl.octopus.OctopusVis.removeAllActors(OctopusVis.java:784)
> > >         at mil.army.arl.octopus.ComposeGUI.<init>(ComposeGUI.java:204)
> > >
> > >         at
> > >
> >mil.army.arl.octopus.OctopusGUI$ItemHandler.actionPerformed(OctopusGUI.java:334)
> > >
> > >         at
> > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
> > >
> > >         at
> > >
> >javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
> > >
> > >         at
> > >
> >javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
> > >
> > >         at
> > >
> >javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:268)
> > >
> > > ...
> > >
> > >
> > > The line from mil.army.arl.octopus.OctopusVis.RemoveAllActors() is:
> > >
> > > vtk.vtkActorCollection actorcollection =
> > > renPanel.GetRenderer().GetActors()
> > >
> > > actorcollection.InitTraversal(); // This is where the null pointer
> > > exception occurs because even if there are actors in the renderer the
> > > actorcollection is null.>From: Jeff Lee
> > > >To: Brian Henz
> > > >Subject: Re: [vtkusers] Java GetActors()
> > > >Date: Mon, 16 Apr 2001 16:34:48 -0400
> > > >
> > > >How does it fail? A stack trace would be helpful.
> > > >-Jeff
> > > >
> > > >Brian Henz wrote:
> > > >
> > > > > I just downloaded the new precompiled Windows and the vtk.tar.gz
> > > files for
> > > > > Unix. After Installing and compiling I find that GetActors()
> > > returns null.
> > > > > Here's an example of what I do:
> > > > >
> > > > > vtkPanel renPanel = new vtkPanel();
> > > > > ...
> > > > > Add Some Actors
> > > > > ...
> > > > > // Now to remove actors
> > > > > vtk.vtkActorCollection actorcollection =
> > > > > renPanel.GetRenderer().GetActors();
> > > > >
> > > > > // But this next line fails because actorcollection == null.
> > > > > // There are actors in the renderer because I can see them and
> > > > > // If i know the actor's name I can delete it. The same
> > > > > // code worked with the 04/04/2001 version.
> > > > > actorcollection.InitTraversal();
> > > > >
> > > > > Any ideas would be greatly appreciated. Also, on an SGI machine
> > > with JDK
> > > > > 1.3 the vtkPanel does not show up. (I had this a long time ago but
> > > was
> > > > > kinda fixed recently when vtkPanel created a seperate Render
> > > window.)
> > > > >
> > > > > Thanks,
> > > > > Brian
> > > > > _________________________________________________________________
> > > > > Get your FREE download of MSN Explorer at http://explorer.msn.com
> > > > >
> > > > > _______________________________________________
> > > > > This is the private VTK discussion list.
> > > > > Please keep messages on-topic. Check the FAQ at:
> > > > > Follow this link to subscribe/unsubscribe:
> > > > > http://public.kitware.com/mailman/listinfo/vtkusers
> > > >
> > > >--
> > > >J.A. Lee
> > > >
> > >
> > > -----------------------------------------------------------------------
> > > Get your FREE download of MSN Explorer at http://explorer.msn.com
> > > _______________________________________________ This is the private
> > > VTK discussion list. Please keep messages on-topic. Check the FAQ
> > > at: Follow this link to subscribe/unsubscribe:
> > > http://public.kitware.com/mailman/listinfo/vtkusers
> >
> >--
> >J.A. Lee
> >
> >
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com

--
J.A. Lee


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010417/f4232eac/attachment.htm>


More information about the vtkusers mailing list