[vtkusers] Using VTK with Java with some problems

Kevin Wright krw at viz-solutions.com
Mon Sep 17 11:51:46 EDT 2001

I embedded a VTK window into a Java application a few years ago, and had some
trouble because I mixed the vtkPanel (which is Java 1.1 code) with GUI widgets
from the Swing Set (Java 1.2).  If you put the vtkPanel into a Swing Set frame
(JFrame), I think that you'll get the problem you're complaining about.  Two
choices are to reimplement the vtkPanel using Swing Set widgets which requires
you to know more about Java than I do, or to selectively use 1.1 widgets to
avoid the problems you're facing.  You don't have to get rid of all swing set
widgets, just the ones directly up the tree from the VTK viewer.

Hope that helps,

> Hi all.
> I'm developing an application in Java, using VTK to show some 3D objects.
> I need to develop some functionalities like cutting planes, picking
> objects, camera interaction, parallel projections and so on. Furthermore I
> need to put the render panel on a window with some GUI, like buttons,
> labels, textfields, etc.
> I'm having problems to implement this in VTK, perhaps because I'm not a
> VTK guru. The main problems are:
> I have extended a JPanel in wich I add the Canvas that shows the
> renderWindow. I have copied some code from vtkPanel and added on this
> class to implement the render function, mouse interaction, etc.
> The problem is that when I add other GUI objects to this JPanel extended
> class I can't see it. I add the canvas to the center using a BorderLayout
> and another JPanel with border and some JLabel to the east. I can see this
> panel. How can I show it? Have somebody done this?

More information about the vtkusers mailing list