RE: VisAD threading problems

Hi Bill and Curtis,

Hava a look at the following link:

It would only be reasonable to have a separate thread do the rendering if
the rendering were being done to a buffered image.  But once that image
needs to be displayed on the canvas, it _must_ be done in the GUI thread to
behave properly.

I have still had rare weird behaviour when I use mouse interactions, even
after the fix Bill did a few weeks ago, and now it seems that threading
problems are the likely source.

If a non-GUI thread needs to update swing components, you can use
SwingUtilities.invokeLater(Runnable).  The Runnable will be queued and run
later by the GUI thread.

In answer to your question, Curtis, about whether I'm calling setAutoAspect
before the display's GUI component's bounds are set, the answer is yes.  But
I'm actually reusing the same display repeatedly, doing different plots
depending on other user action, so in fact auto-aspect and bounds are both
previously set before I even set new maps and data-reference.

My JTabbedPane resizing problem is coming from rendering occuring when it
shouldn't - as if paint were being invoked directly instead of repaint.  But
it's not only the auto-aspect that causes it - it's still occuring when I
have auto-aspect turned off.

Now I'm going to go read the article Curtis referenced...


> -----Original Message-----
> From: owner-visad-list@xxxxxxxxxxxxx
> [mailto:owner-visad-list@xxxxxxxxxxxxx]On Behalf Of Bill Hibbard
> Sent: Saturday, June 21, 2003 2:01 PM
> To: Ian Graham
> Cc: VisAD List
> Subject: Re: VisAD threading problems
> Hi Ian,
> > I'm getting some occasional display update problems, and I'm
> suspicious that
> > VisAD is updating Swing components from outside the UI thread. . . .
> Sure is. In a DisplayImplJ2D, which you mention, getGraphics().drawImage()
> is invoked for the VisADCanvasJ2D, which extends JPanel, from the
> "rendering" Thread constructed by the VisADCanvasJ2D. This Thread is
> triggered by:
> 1. AnimationControlJ2D for animation.
> 2. Any event triggering re-transform of Data into depictions.
> 3. User mouse interactions to pan or zoom the display.
> Is this improper behavior for a class extending JPanel? I will
> be happy to change this, as long as it can accomodate redraws
> triggered by the three types of event I listed.
> Cheers,
> Bill

  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: