[vtkusers] VTK + Java Swing

Jonathan Morra jonmorra at gmail.com
Wed Oct 20 16:30:34 EDT 2010


I am trying to put a vtkCanvas into a Swing application.  As you know
vtkCanvas extends vtkPanel which extends java.awt.Canvas.  This is a
heavyweight Java UI component.  Swing is composed of lightweight components.
 It turns out that mixing heavy and light components is very difficult to
create an application that works well.

I tried editing the vtkPanel class to extend JPanel instead of Canvas, and
changed the name of the paint(Graphics g) method to paintComponent(Graphics
g), and verified that indeed it is getting called.  However it does not
paint the vtkPanels into the swing components, instead it paints them in
their own VTK windows.

After more investigation I found the file vtkJavaAwt.h which defines the
native method RenderCreate.  This is where the AWT magic is happening and
the render window is being moved to the AWT drawing surface.  I'm not
experienced enough to modify this function.

Here are my questions
1.  Is there a class analogous to vtkPanel that extends something from the
javax.swing package?
2.  Is this a problem someone is already working on, or is it on the VTK
roadmap?
3.  Does the community of people using Java swing with VTK care about this
(I know for me it's a big deal, but I want to make sure other people agree
with me).

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101020/163fe367/attachment.htm>


More information about the vtkusers mailing list