[vtkusers] java's vtkPanel does too much

Steve M. Robbins steven.robbins at videotron.ca
Fri Feb 25 08:36:35 EST 2005


Hi,

A question to fellow Java/VTK users.

We're going to use VTK with our own handling for mouse and keyboard
events.  However the base java Component -- vtkPanel -- registers
mouse and keyboard listeners, which I find inconvenient.

For playing with VTK, I resorted to deriving a "bare" vtk panel class:


  public class vtkBarePanel extends vtkPanel
  {
      public vtkBarePanel()
      {
          removeMouseListener(this);
          removeMouseMotionListener(this);
          removeKeyListener(this);
      }
  }


This strikes me as inverted: the base class should be bare, with a subclass
that adds default mouse & keyboard handling.  Don't you agree?

I'm prepared to submit a patch to fix this by introducing
vtkBarePanel, moving the native methods there, and having vtkPanel
derive from it.

I'm mainly wondering about naming.  My preference would be that the
compoment be called vtkCanvas, since it derives from an AWT Canvas.
But that name's already taken for a subclass of vtkPanel that uses
render window interactor!  Thus, I'm proposing vtkBarePanel as a
compromise.  I'm open to suggestions.

-Steve

[Incidentally, I've played a /little/ bit with example code using
render window interactor and find it is very easy to crash the JVM
with a segfault in VTK code.  I stress that I haven't done too much
playing, but I'm curious: are others out there using render window
interactors with java?]




More information about the vtkusers mailing list