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.
here's a tidbit out of some of my code... Calling DsiplayImpl.getImage() from a seperate thread is necesary if the code is called from the main event thread... final DisplayImpl d = // your specifics here... (new Thread() { public void run() { try { java.awt.Image i = av.getDisplay().getImage(); javax.swing.JFileChooser c = null; java.io.File f = null; java.io.FileOutputStream fos = null; c = new javax.swing.JFileChooser(); String[] filterTypes = {"jpg"}; com.klg.jclass.util.swing.JCFileFilter filter new com.klg.jclass.util.swing.JCFileFilter(filterTypes , "JPEG Image"); c.addChoosableFileFilter(filter); int returnVal = c.showSaveDialog(null); if(returnVal != javax.swing.JFileChooser.APPROVE_OPTION) { return; } f = c.getSelectedFile(); if(!f.getName().endsWith(".jpg")) { f = new java.io.File(f.getPath().concat(".jpg")); } fos = new java.io.FileOutputStream(f); ij.io.JpegEncoder jpg = new ij.io.JpegEncoder(i, 90, fos); jpg.Compress(); fos.close(); } catch (java.io.IOException e) { } } }).start(); > -----Original Message----- > From: owner-visad-list@xxxxxxxxxxxxx > [mailto:owner-visad-list@xxxxxxxxxxxxx]On Behalf Of Brobbey,Isaac > Sent: Thursday, September 05, 2002 1:48 PM > To: 'Carlos Pleguezuelos ' > Cc: 'visad-list@xxxxxxxxxxxxx ' > Subject: Saving current display... > > > hi all: > > i need some insight in to the constructors for saving a current > display as a > JPEG file .i am wondering if i can pass the display to the Filesaver > like > > FileSaver save =new FileSaver(display); > > i will appreciate any help > > thanks.... > > Isaac > > > >
visad
archives: