Re: stuck at getImage()'s wait()

Ben Monnahan wrote:
> 
> On Fri, Aug 16, 2002 at 04:52:28PM -0500, Bill Hibbard wrote:
> > Hi Ben,
> >
> > visad/examples/Test50.java uses the getImage() method to
> > capture an image from a DisplayImplJ2D. It works on my
> > machine. Does it work on yours? Note there are two windows,
> > one for the DisplayImplJ2D (where you can drag the image
> > around with left mouse clicks) and another that shows the
> > result of getImage() calls once per second.
> >
> > If it works on your system, then we need to figure out what
> > is different about your application. You might send me a
> > short test program that demonstrates your problem.
> >
> > Cheers,
> > Bill
> 
> Ok I figured out what was causing my problem.  If you don't add the
> display.getComponent to a frame, it hangs at the wait.  You can see this
> in Test50 by just commenting out the jframe.setContentPane line.  I
> wasn't doing this because I am writing an application that generates
> some images to put on a web page.  I can get around having to actually
> display it by not showing the frame. This may be the intended or
> required behavior but I thought I'd point it out just in case.

You may want to use the DisplayImplJ2D constructor for
offscreen rendering:

  public DisplayImplJ2D(String name, int width, int height)

This will let you call getImage() without adding its Component
(it doesn't even have one) to a Frame.

Cheers,
Bill


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