[vtkusers] GraphLayoutView in a JFrame

Jeff Baumes jeff.baumes at kitware.com
Fri Nov 2 09:57:44 EDT 2012


I forgot to copy the users list on this. Scott replied that this solution
worked for him.

On Thu, Nov 1, 2012 at 7:57 AM, Jeff Baumes <jeff.baumes at kitware.com> wrote:

> On Mon, Oct 29, 2012 at 3:04 PM, Scott Kelly <stk at veritegroup.com> wrote:
>
>> I'm having issues trying to integrate a vtkGraphLayoutView into a Jframe.
>>   The java app starts fine and the vtk panel sometimes initially displays
>> the graph but the window flashes and the graph disappears anytime you try
>> to interact with the window.
>>
>>
> I verified this on Windows 7 with Java 1.7 and Java 1.5 and was able to
> reproduce the problem in both cases. I believe what happened is that there
> were some tweaks to how VTK views can associate with other render windows
> that were not propagated to the Java examples.
>
>
>
>> I'm using Java 1.7_09, VTK 5.10.1 and Win7 x64 (I've also tried MacOS)
>>
>> An example of the behavior can be reproduced with both the Focus.java and
>> TreeViews.java examples included with VTK.  My code pretty much follows how
>> these two examples include a vtkRenderWindowPanel in a Jframe.
>>
>> If I try to render the GraphLayoutView directly everything works fine,
>> but the window is outside of the Jframe.
>>
>
> Try changing code like this:
>
> panel = new vtkRenderWindowPanel(view.GetRenderWindow());
>
> with these two lines:
>
> panel = new vtkRenderWindowPanel();
> view.SetRenderWindow(panel.GetRenderWindow());
>
> This sets the panel's render window on the view instead of attempting to
> do the reverse. This made TreeViews.java function much better, though there
> was still a bit of a glitch for me on first render (all grey). Once I
> clicked in the window all was well.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121102/18d7f6e8/attachment.htm>


More information about the vtkusers mailing list