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.
Hi Astrid, Your getBufferedImage() method returns null because it does not synchronize with the new Thread it creates. It returns VectorImage before the Thread's call to getImage() returns. Have you tried simply calling display.getImage() from the getBufferedImage() method? If that doesn't work, then move the code that processes the BufferedImage into the run() method of your new Thread. Some of the other VisAD developers know more about printing than I do - perhaps they will comment. Cheers, Bill ---------------------------------------------------------- Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706 hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738 http://www.ssec.wisc.edu/~billh/vis.html On Sun, 21 Jan 2001, Astrid Wonner wrote: > Hello!! > > I have a number of Panels containing DisplayImplJ2Ds in one Frame. Now I want > to print them with one PrinterJob and so try to get Images with the following > method in the class producing them: > > public BufferedImage getBufferedImage() > { > Runnable gettingImage = new Runnable() > { > public void run() > { > try > { > VectorImage = display.getImage(); > } > catch (Exception pe) { pe.printStackTrace(); } > } > }; > > Thread t = new Thread(gettingImage); > t.start(); > > return VectorImage; > } > > All I get is an empty Image. I've read all about it in the > Mailing-List-Archive (e.g. the Thread-idea) but found nothing that runs... > Can somebody help me? > Thanks > > Astrid >
visad
archives: