[vtkusers] vtk + JAVA Swing

Jeff Lee jeff at cdnorthamerica.com
Thu May 8 09:01:33 EDT 2003


Hi John,
Here is a modified vtkPanel which shows a popup menu when invoked with  
<SHIFT>-MB1.  You can diff this vtkPanel against cvs to see what I 
added, but it is pretty straightforward.  I quoted our previous message 
for the mailing list.

John Biddiscombe wrote:

> Does anyone know if the JAVA vtkPanel control can be made to work by 
> deriving it from a JComponent rather than a Canvas class.


There are ways to do this that would involve sacrifice of hardware 
acceleration - basically replacing the native render window with an 
image of the render window contents.  Interaction will be slow, and you 
would need to render offscreen.  A compromise might be to only do this 
when the user tries to invoke a widget which will be displayed on top of 
the render window.

> I want to put the panel into a JLayeredPane and place other 
> (lightweight) controls over the top.


a render window inside a JComponent will always be on-top, except for 
the case where JPopupMenu.setLightWeightPopupEnabled(false) is called, 
which allows menus/popups to be displayed as heavyweight, thus obeying 
z-order when displayed atop another heavyweight component (see modified 
vtkPanel).  What types of controls do you intend to use? -Jeff

> Currently it overwrites anything else in the same screen space 
> (Presumably blitting on top of anything drawn using native swing-type 
> code).
>  
> thanks
>  
> JB
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPanel.java
Type: text/x-java
Size: 11622 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030508/1d99d606/attachment.java>


More information about the vtkusers mailing list