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 All, Thanks you for your kind suggesstions. We tried as you said in yesterday's mail. We tried to create a thread in the captureDialog() method, and in that method convertGridToImage(File f) is called. We are able to create a jpeg file of the grid but, the entire grid is not saved. We have a 6 X 11 grid. Only the Bottom line of the grid is saved and is visible as jpeg file. We are not able to see the whole grid. Our application generates whole grid using VisAD and it is fully visible as 6 X 11 grid.But when it is saved as jpeg file only bottom line is visible. Please help us. ===================================================== public void convertGridToImage(File f) throws FileNotFoundException, IOException, RemoteException, VisADException { BufferedImage image = display.getImage(); FileOutputStream fout; try { JPEGEncodeParam param JPEGCodec.getDefaultJPEGEncodeParam(image); param.setQuality(100, true); fout = new FileOutputStream(f); JPEGImageEncoder encoder JPEGCodec.createJPEGEncoder(fout); encoder.encode(image, param); fout.close(); } catch (NoClassDefFoundError err) { throw new VisADException("JPEG codec not found"); } } public void captureDialog() throws VisADException, RemoteException{ final File f = new File("c:/jpegfile.jpeg"); if (f == null) return; Runnable captureImage = new Runnable() { public void run() { String msg = "Could not save image snapshot to file \"" + f.getName() + "\" in JPEG format. "; try { convertGridToImage(f); } catch (VisADException exc) { System.out.println("Error in image saving"); } catch (IOException exc) { System.out.println("Error in image saving"); } } }; Thread t = new Thread(captureImage); t.start(); } ===================================================== with regards, Karan Kapoor. __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
visad
archives: