[vtkusers] Re : Re: VTKPanel +Swing - repainting issue
Jerome Robert
jeromerobert at gmx.com
Tue Jun 22 09:25:12 EDT 2010
Ok this is not a VTK problem. You cannot call repaint from paintComponent, as repaint call paintComponent. You have an infinit recursion there. It doesn't trigger a StackOverflowException because the paint event is posted through the event queue. In other word you program is flooding the event queue.
> ----- Message d'origine -----
> De : Markus Ott
> Envoyés : 22.06.10 14:05
> À : Jerome Robert
> Objet : Re: [vtkusers] VTKPanel +Swing - repainting issue
>
> What i do actually:
>
> I override paintComponent of my infoPanel as follows:
>
> public void paintComponent(Graphics g){
>
> repaint();
> }
>
> You will find a screenshot attached.
> This is all it needs to gray out the vtkCanvas.
>
> I get the following when i click on it and try to move with pressed
> mouse button:
>
> --------------------------------------------------------------------------
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at vtk.vtkPanel.UpdateLight(vtkPanel.java:211)
> at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:230)
> at java.awt.Component.processMouseMotionEvent(Unknown Source)
> at java.awt.Component.processEvent(Unknown Source)
> at java.awt.Component.dispatchEventImpl(Unknown Source)
> at java.awt.Component.dispatchEvent(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Jerome Robert schrieb:
> > Do you call repaint from the EDT ?
> >
> > Could you give the stack of you NullPointerException ?
> >
> >> ----- Message d'origine -----
> >> De : Markus Ott
> >> Envoyés : 22.06.10 11:28
> >> À : Jerome Robert
> >> Objet : Re: [vtkusers] Re : VTKPanel +Swing - repainting issue
> >>
> >> Hi Jerome,
> >>
> >> thank you for your quick reply.
> >> The application is running on a Windows Vista machine.
> >>
> >> I use a simple BorderLayout with vtkPanel at BorderLayout.CENTER and the
> >> infoPanel at BorderLayout.LINE_START.
> >>
> >> Overriding removeNotify() as in http://www.vtk.org/Bug/view.php?id=7107
> >> doesn't help here.
> >>
> >> Jerome Robert schrieb:
> >>> On Windows, running your Java application with -Dsun.java2d.ddoffscreen=false -Dsun.java2d.gdiblit=false may help removing the flickering effect.
> >>>
> >>> I don't think it's a lightweight/heavyweight problem as one panel is not hidding an other. It could be related to http://www.vtk.org/Bug/view.php?id=7107
> >>>
> >>> Which layout do you use in your main JPanel ?
> >>>
> >>> Jerome
> >>>
> >>>> ----- Message d'origine -----
> >>>> De : Markus Ott
> >>>> Envoyés : 21.06.10 18:28
> >>>> À : vtkusers at vtk.org
> >>>> Objet : [vtkusers] VTKPanel +Swing - repainting issue
> >>>>
> >>>> Hello vtkusers!
> >>>>
> >>>> I'm using VTK within Java. I have a simple layout with a JPanel
> >>>> containing another information panel on the left side and a vtkPanel on
> >>>> the right side.
> >>>>
> >>>> When i'm trying to override paintComponent()-methods of my infoPanel and
> >>>> call the repaint() method the whole program's visual representation
> >>>> messes up. I.e. i have only black and grey representations of my gui
> >>>> elements and vtkPanel isn't usable any more (if i click it i get a
> >>>> nullPointerException).
> >>>>
> >>>> I think it has something to do with mixing lightweight and heavyweight
> >>>> components within java.
> >>>>
> >>>> Also the vtkPanel is flickering while resizing the window or if other
> >>>> programs are on top of it. I think this may be based upon the same problem.
> >>>>
> >>>> Has anybody an idea what to do?
> >>>>
> >>>> Regards,
> >>>> Markus
> >>> _______________________________________________
> >>> Powered by www.kitware.com
> >>>
> >>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> >>>
> >>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> >>>
> >>> Follow this link to subscribe/unsubscribe:
> >>> http://www.vtk.org/mailman/listinfo/vtkusers
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list