Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

Re: getImage exception

Hi Paul,

I believe the problem you encountered is similar to mine,
i.e. you may not call getImage() displayImpl.java directly
via AWT-Event Queue.

You may overcome this problem using the InvokeLater() method
of Java's SwingUtilities.

I avoided the same problem via implementing a method in my display 
manager directly through a direct thread. Someting like this:


class DisplayManager {
   ....
   DisplayImpl display;
   BufferredImage bimg;
   ....
   ....
   public void invokeGetImage()
   {
      // ************************************
      // *  Make a thread to do the job     *
      // ************************************
      Runnable captureImage = new Runnable() {
          public void run() {bimg=display.getImage();}
      };
      Thread t=new Thread(captureImage);
      t.start();
      
      ... wait for a while for thread to finish!...
      if(bimg!=null) { // you have image

        .... // do whatever you want
      }
   }
   ....
}

I hope the above would help.

Cheers

Ng Say Teong.


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