NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: VisAD threading problems

Hi Ian,

>1) Plot in JTabbedPane painting when a different tab is active,
>   thereby writing all over current tab panel.

This sounds like a heavyweight/lightweight issue. Sun has a good
overview of the issue at:
   http://java.sun.com/products/jfc/tsc/articles/mixing/

However, it was my impression that DisplayImplJ2D is not a
heavyweight component (the heaviness is a Java3D issue, so
DisplayImplJ3Ds are heavy, but VisADCanvasJ2D extends JPanel,
and should thus be lightweight).

>2) I have a dialog box which changes plot data, removing old
>   maps and references, adding new ones.  When I click OK,
>   sometimes plot display is incomplete.  Clicking the mouse on
>   the plot seems to cause it to update ok.

I don't think you are the first person to mention this problem.
However, I've never seen it happen myself.  You could always try
calling validate() and/or repaint() on your GUI manually, to see
if that does the trick.

>Possibly it makes a difference that I have
>DisplayImplJ2D.setAutoAspect(true).  I have noticed that often a plot is
>painted initially with the original 1:1 aspect and is immediately repainted
>with the new aspect ratio.

I'm not positive what's going on here either. Are you calling
setAutoAspect before doing pack() on the window? The auto-aspect
logic only kicks in when setBounds is called on the display's
GUI component. It may also be that VisAD is re-rendering the
data in a separate thread, and thus you're seeing the old
projection for a moment before it completes the new projection
based on the adjusted aspect ratio.

>Ah, I just did something else that _is_ repeatable.   If I have several
>different plots, each in their own separate tab within a JTabbedPane, and
>then I resize the window, all of the plots repaint overtop of the active tab
>panel.  I'm not sure that this has anything to do with thread issues.  I'll
>try to get a small demo app together on Monday and send it out.

Again, this sounds like the heavyweight/lightweight issue,
but that's just a guess.

-Curtis


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