[vtkusers] can I use Java's paint() to render over a vtkPanel?

Steve M. Robbins steven.robbins at videotron.ca
Wed Feb 2 17:26:23 EST 2005


Hi,

I'm working with vtk 4.2 and java.

I'd like to display some overlay information in the vtkPanel window
over top of the VTK rendering.  My first attempt was to simply
override vtkPanel's paint() method. 

Using the Assembly.java example from http://ij-plugins.sourceforge.net/vtk-examples/,
I tried replacing

	renWin = new vtkPanel();

by

	renWin = new vtkPanel() {
            public void paint( Graphics g )
            {
                super.paint( g );
                g.drawString( "Overlay", 50, 50 );
            }
        };


The window comes up OK.  However, when I interact with it, the
rendering all goes on in VTK and java's paint() is not called.
The effect is that the overlay goes away.

So my next thought was to catch the "EndEvent" from the
vtkRenderWindow and draw the overlay at that time.  The wrinkle
is that I need a java Graphics object to do the drawing which
I don't have.  I tried a couple of ways to call repaint()
without getting into an infinite loop of painting, but I
haven't managed it yet.

Is there a way to achieve what I want?

Thanks,
-Steve



More information about the vtkusers mailing list